I made a simple "name and email" contact form and I would want it to redirect to "page2.html" after the information has been submitted.
I cant get it to work.
This is the html part I made for the submission form. Im still not sure what does "name" part stand for, the id part (with the dash) refers to CSS styling. But anyhow, this is how I made the contact "name and email" form.
<form method="post" action="submission.php" name="contactform" id="contact-form">
<fieldset>
<label for=name accesskey=U><span class="required">*</span> Name</label>
<input name="name" type="text" id="name" size="30" value="" />
<br />
<label for=email accesskey=E><span class="required">*</span> Email</label>
<input name="email" type="text" id="email" size="30" value="" />
<br />
<input type="submit" class="submit" id="submit-button" value="Submit" />
</fieldset>
</form>
and php part is recycled, i tried entering header with redirect in the last line but it doesnt work, the best it does is opens up a blank page in the browser that prints out the info I entered in the form.
I would like to have the form redirect after the info has been submitted, so...thanks for help, in advance :D
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("jqueryui", "1.5.2");</script>
<?
if($_POST['name']!="" ){
$headers = "From: Webmaster";
$message =
strtoupper($_POST['name'])."
".strtoupper($_POST['email'])."
";
echo str_replace("
","<br />", $message);
$headers2 = "From: Sender Name <email@gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailer: PHP
";
$message2 = "Message
";
mail("webmaster@gmail.com", "Subject", $message, $headers);
mail("$_POST[email]", "Subject", $message2, $headers2);
$myFile = "submissions.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "$_POST[name]*$_POST[email]*".$_SERVER['REMOTE_ADDR']."*".date("d-m-Y H:i")."
";
fwrite($fh, $stringData);
fclose($fh);
} else {
echo "You didnt enter anything";
?>
<script language="javascript">
alert("You didnt enter anything");
</script>
<?
}
?>