How do i get an redirect back to the main page in this script after clicking the submit button?
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Tell A Friend</title>
</head>
<body>
<form method="post" action="tell_a_friend.php" />
<input name="dinemail" type="text" value="Your Email..." />
<input name="kompisemail" type="text" value="Friends Email..." />
<input name="tipsa" type="submit" value="Submit" />
</form>
<?php
$to = $_POST['friendsemail'];
$from = $_POST['youremail'];
$headers = "From: $from";
$subject = "Page"; // Header in email
$url = "http://www.sportextra.nu"; // Url'to your site
$mess = "text in the email: $url"; // Message
if (isset($_POST['submit'])){
if (trim($to) == "" or trim($from) == "" or trim($to) == "Your Friends Email..." or trim($from) == "Your Email..."){
echo "Both fields must be filled in"; }
else {
mail("$to", "$subject", "$mess", "$headers");
echo "The Link Is Send";
}
}
?>
</body>
</html>