redirect after form submit - help please!
I'm pretty decent at figuring out stuff, but this made me slightly annoyed earlier
this evening.
As the post headline states, I want to redirect to a custom page after a visitor
submits an email form. The way it initially, and still, works is to open a browser
window with only, "Thank you for your message." displayed. (Pretty lame and
embarrassing.)
Here are the details:
1. Simple html form on an html page with contact.php on server.
2. Googled all over for relevant info. Found lots of it, tried quite a few things to
no avail. Some of it was over me hurting head.
3. Grabbed a php redirect script. Here's a laff... wasn't sure WHERE it went. I
perhaps stupidly assumed it went on the contact.php page.
4. Kept getting syntax/format errors for this line:
header('Location: http://website.com');
5. Tried using a js code in the html page header area and
changing the form code from 'submit' to jump. Like this...
<input type="submit" onClick="jump()">
Header area code:
<script language="javascript">
function jump()
{
window.location = 'http://www.website.com';
}
</script>
</head>
<body>
Well... that didn't work.
So ok, I've read about putting the php header redirect before
any outputs, echo commands, etc.
I'm aware about avoiding blank lines and <? being on the first line
of the page.
Here's the original contact.php code:
<?
$subject="from ".$_GET['your_name'];
$headers= "From: ".$_GET['your_email']."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
mail("blahblah@gmail.com", $subject, "
<html>
<head>
<title></title>
</head>
<body>
<br>
".$_GET['message']."
</body>
</html>" , $headers);
echo ("Your message was successfully sent! ");
?>
<script>
resizeTo(800, 600)
//window.close()
</script>
Here's the php script I was trying to make work:
<?php
/* Redirect browser */
header("Location: http://blahblah.com");
/* Make sure that code below does not get executed when we redirect. */
exit;
?>
Oh...
I also tried a meta refresh with 0 seconds in the stupid blank page
that tells people their message was sent.
Pretty sure I had that in the right place, but no worky. It laffed at
me and pointed it's finger whilst laffing.
I pains me to admit I'm redirect challenged.
Can anyone help?
I'm going to bed, now.
Thank you, and good night.
-- Lisa G
-- Lisa G
-- Lisa G
-- Lisa G