PHP email script and Thank You

Hello again everyone, I have a simple PHP email script that works fine, however in the redirect at the bottom of the script, I have always had it pointed at a simple thank you page. This time though, I was wanting to try redirecting to the same page as the form was on but have it say some type of thank you message above the form. Does that make any sense?

Here is my PHP mailer script:
[php][php]<?php

$to = “************” ;
$from = $_REQUEST[‘name’] ;
$email = $_REQUEST[‘email’] ;
$tel = $_REQUEST[‘tel’] ;
$message = $_REQUEST[‘message’] ;
$headers = “From: $from”;
$subject = “Online Contact Form”;

$fields = array();
$fields{“name”} = “Customer Name”;
$fields{“email”} = “Email Address”;
$fields{“tel”} = “Telephone Number”;
$fields{“message”} = “Message”;

$body = “We have received the following information:\n\n”; foreach($fields as $a => $b)
{ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

 $send = mail($to, $subject, $body, $headers);

header( “Location: http://www.************.com#connect” );

?> [/php][/php]

Just redirect back to the form with an extra variable?

form.php?thankyou=1

Thank you for your reply sir, however, I do not quite understand.

where will ‘?thankyou=1’ take the user too? Do I need to add any code to the html for this as well?

Sponsor our Newsletter | Privacy Policy | Terms of Service