Jump to content

Get a forward from my contact us form


lewievangaal

Recommended Posts

Hey there

 

Using the following, very basic, contact us code how can I get the page to forward to www.domain.com/thankyou.shtml?

 

      <?

$form_block = "

<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">
<BR>
<table width=\"100%\" height=\"70%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"navy\">
   <div align=\"center\">
<tr>
<td><h3>Name:</h3></td>
<td><INPUT type=\"text\" NAME=\"sender_name\" VALUE=\"$sender_name\" SIZE=30></td>
</tr>

<tr>
<td><h3>Email:</h3></td>
<td><INPUT type=\"text\" NAME=\"sender_email\"  VALUE=\"$sender_email\" SIZE=30></td>
</tr>

<tr>
<td><h3>Address:</h3></td>
<td><TEXTAREA NAME=\"address\" COLS=30 ROWS=5 WRAP=virtual>$address</TEXTAREA></td>
</tr>

<tr>
<td><h3>Telephone:</h3></td>
<td><INPUT type=\"text\" NAME=\"contact_number\"  VALUE=\"$contact_number\" SIZE=30></td>
</tr>

<tr>
<td><h3>Message:</h3></td>
<td><TEXTAREA NAME=\"message\" COLS=30 ROWS=5 WRAP=virtual>$message</TEXTAREA></td>
</tr>

<INPUT type=\"hidden\" name=\"op\" value=\"ds\">

<tr>
<td></td><td><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Submit\"></td>
</tr>

</DIV></TABLE>

</FORM>

";

if ($op != "ds") {

// they need to see the form
echo "$form_block";

} else if ($op == "ds") {

if ($sender_name == "") {
	$name_err = "<font color=red>Please enter your name!</font><br>";
	$send = "no";

} 

if ($sender_email == "") {
	$email_err = "<font color=red>Please enter your e-mail address!</font><br>";
	$send = "no";

} 

if ($message == "") {
	$message_err = "<font color=red>Please enter a message!</font><br>";
	$send = "no";

} 

if ($send != "no") {

	// it's ok to send!
	$msg = "Enquiry from website\n\n";
	$msg .= "From:				$sender_name, $sender_email\n";
	$msg .= "Address:			$address\n";
	$msg .= "Contact number:	$contact_number\n";
	$msg .= "Enquiry:			$message\n\n";

	$to = "[email protected]";
	$subject = "Enquiry from website";
	$mailheaders = "From: Website <[email protected]> \n";
	$mailheaders .= "Reply-To: $sender_email\n\n";

	mail($to, $subject, $msg, $mailheaders);
require ('mail_sent.php');


} else if ($send == "no") {
$send="no";	
	echo "$name_err";
	echo "$email_err";
	echo "$message_err";
	echo "$form_block";  


} 

}

?>

 

Can't seem to get it to work. Don't want to alter code majorly unless I really have to. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/41598-get-a-forward-from-my-contact-us-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.