conatct form
2 naročnika
2 naročnika
pozdravljeni!
imam simple kontakt form in me zanima kako bi lahko iz common.php klical v contact.php svoj email naslov?
common.php izgleda tako:
<?php
$email = "mojemail@gmail.com";
?>
contact.php pa:
<?php include("common.php"); ?>
<head></head>
<body>
<p><?php
if (isset($POST['poslji'])) {
// zadevo lahko spremenite
$subject = $POST['subject'];
$sporocilo= $POST['sporocilo'];
$ime= $POST['ime'];
$mail= $_POST['mail'];$header="from: $ime <$mail>";
//spremeni v tvoj email naslov
$to ='mojmail@gmail.com';if(empty ($ime)) {
echo "Please enter name!<br /><br />";
}else if(empty($mail)) {
echo "Please enter valid e-mail!<br /><br />";
}else if(empty($sporocilo)) {
echo "Please enter message!<br /><br />";
}//else v tem primeru po?lje mail na tvoj naslov.
else {
$send_contact=mail($to,$subject,$sporocilo,$header);
echo "Your message has been send!<br /><br />";
$sporocilo= "";
$ime= "";
$mail= "";
}
}
?>
<form action="" method="post">
Name: <input type="text" name="ime" size="15" value='<?php echo"{$ime}"; ?>'><br /><br />
E-mail: <input type="text" name="mail" size="15" value='<?php echo"{$mail}"; ?>'><br /><br />
Subject: <input name="subject" type="text" id="subject" value="<?php echo"{$subject}";?>"/><br /><br />
Message:<br />
<textarea rows="15" cols="50" name="sporocilo" ><?php echo"{$sporocilo}"; ?></textarea><br />
<button name="poslji" type="submit">Send</button>
</form></p>
</body>
</html>
in če spremenim $to ='mojmail@gmail.com'; v $to ='<?php echo $email ?>'; mi ne kliče iz common.php. prodil bi če mi kdo reši ta problem