ADLE
10-01-2008, 03:42 PM
Hello all, need some help. Need to redirect page after submit. Here is my contact.html form:
<form name="contactform" action="contactform.php" method="post">
<table border="0" cellpadding="3">
<tr>
<td><font size="6"><a href="http://www.something.com/" style="text-decoration:none">HOME</a></font></td>
<td rowspan="7" width="1020"><center><font size="3">IF YOU HAVE A QUESTION, COMMENT, OR INQUIRY REGARDING RATES PLEASE CONTACT US AT:<br />INFO@SOMETHING.COM<br /><br />YOU MAY ALSO CONTACT US THROUGH OUR FORM:<br /><br />
NAME:<input type="text" size="36" name="name" class="text1" style="font-family: times" />
<br />
EMAIL:<input type="text" size="36" name="email" class="text2" style="font-family: times" />
<br />
<br />
<textarea name="text" rows="5" cols="139" style="font-family: times">
</textarea>
<br />
<br />
<a onclick="document.contactform.reset();return false;" href="#"><img alt="Reset" src="reset.gif" border="0" /></a> /
<input type="image" src="submit.gif" alt="Submit" />
</font></center></td>
</tr>
Here is my contactform.php file:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$text = $_POST['text'];
mysql_connect ("xxxxx", "xxxxx", "xxxxx") or die ('Error: ' . mysql_error());
mysql_select_db ("xxxxx");
$query="INSERT INTO contacttable (name, email, text)VALUES ('$name','$email','$text')";
mysql_query($query) or die ('error updating database' . mysql_error());
?>
Once i sumbit, the window goes blank, to www.something.com/contactform.php with "done" at bottom of page. The input is sent to my databse perfectly, but I would like when the form is submitted to clear all fields and stay on the contact page if possible (prefered), or if that can't happen for it to redirect to the contact page after submit with fields all clear.
I know nothing of php, just been inputing what everyone suggest. which has been a great help. This is the last problem i need fix and my contact page would be ready. anyone know what to insert? thanks!
<form name="contactform" action="contactform.php" method="post">
<table border="0" cellpadding="3">
<tr>
<td><font size="6"><a href="http://www.something.com/" style="text-decoration:none">HOME</a></font></td>
<td rowspan="7" width="1020"><center><font size="3">IF YOU HAVE A QUESTION, COMMENT, OR INQUIRY REGARDING RATES PLEASE CONTACT US AT:<br />INFO@SOMETHING.COM<br /><br />YOU MAY ALSO CONTACT US THROUGH OUR FORM:<br /><br />
NAME:<input type="text" size="36" name="name" class="text1" style="font-family: times" />
<br />
EMAIL:<input type="text" size="36" name="email" class="text2" style="font-family: times" />
<br />
<br />
<textarea name="text" rows="5" cols="139" style="font-family: times">
</textarea>
<br />
<br />
<a onclick="document.contactform.reset();return false;" href="#"><img alt="Reset" src="reset.gif" border="0" /></a> /
<input type="image" src="submit.gif" alt="Submit" />
</font></center></td>
</tr>
Here is my contactform.php file:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$text = $_POST['text'];
mysql_connect ("xxxxx", "xxxxx", "xxxxx") or die ('Error: ' . mysql_error());
mysql_select_db ("xxxxx");
$query="INSERT INTO contacttable (name, email, text)VALUES ('$name','$email','$text')";
mysql_query($query) or die ('error updating database' . mysql_error());
?>
Once i sumbit, the window goes blank, to www.something.com/contactform.php with "done" at bottom of page. The input is sent to my databse perfectly, but I would like when the form is submitted to clear all fields and stay on the contact page if possible (prefered), or if that can't happen for it to redirect to the contact page after submit with fields all clear.
I know nothing of php, just been inputing what everyone suggest. which has been a great help. This is the last problem i need fix and my contact page would be ready. anyone know what to insert? thanks!