In my form redirect script I have the following in the original
//redirect to the ‘thank you’ page
header(‘Location: http://urlgoeshere.com’);
I want to replace http://urlgoeshere.com with a hidden variable of the form that sends the link appropriate for that sign up page. We use this as a way to track who views our weekly videos.
The hidden variable is called ‘handler’ and the value will be http://mywebsite.com/postpage
Thus on the send mail form under the above header('Location redirect, I want to insert $handler and have it show that link inside the redirect script.
this is my code that errors
<?php $errors = ''; $myemail = '[email protected]';//<-----Put Your email address here. if(empty($_POST['handler']) || empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) { $errors .= "\n Error: all fields are required"; } $handler = $_POST['handler']; $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; if (!preg_match( "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) { $errors .= "\n Error: Invalid email address"; } if( empty($errors)) { $to = $myemail; $email_subject = "New Monday-Minute Visitor: $name"; $email_body = "You have received a new message. ". " Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message \n Page: \n $handler"; $headers = "From: $myemail\n"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page header( 'Location: $handler' ) ; } ?>