maxelcat
Technical User
- Oct 19, 2006
- 79
Hello all
I want to send a simple email from a form. That all works very nicely. I then want the browser to redirect (in this case to google). I can't get that bit to work. Could somebody please tell me where I am going wrong.
Thanks
I want to send a simple email from a form. That all works very nicely. I then want the browser to redirect (in this case to google). I can't get that bit to work. Could somebody please tell me where I am going wrong.
Thanks
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Survey php</title>
</head>
<body>
<?php
//my first php file!
$to="info@test.co.uk";
$subject = "Customer Satisfaction Survey";
//picks up the names from the form and puts them into strings
$from = "From: " . $_REQUEST['name'];
$email = "email: " . $_REQUEST['email'] . "\n";
$needs = "Needs comment: " . $_REQUEST['needs'] . "\n";
$working = "Working with me: " . $_REQUEST['working'] . "\n";
$quality = "Quality comment: " . $_REQUEST['quality'] . "\n";
$recommend = "Recommendation: " . $_REQUEST['recommend'];
$message = $from ."\n" . $email . "\n" . $needs . "\n" . $working . "\n" . $quality . "\n" . $recommend;
$headers ="From: " . $email;
$sent=mail($to,$subject,$message,$headers);
if($sent)
{header( "Location: [URL unfurl="true"]http://www.google.co.uk"[/URL] );}
else
{print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; }
?>