Hi,
php is a foreign language to me, dont know how to do 2 things.
When the form is filled out and submitted, then the "thank you" message is displayed on a blank white page.
I want the "thank you" to be displayed on a webpage with the navigation etc.
Or when the message comes up for it to be in a new window, so user can just go to website, currently, the fill form out, submit, message appears and website is gone.
I tried to add a url with target blank inside the code but it did not work.
I would really appreciate your help.
Heres the bit of code I think is needing variables.
// if the redirect option is set: redirect them
if ($redirect) {
header("Location: $redirect");
exit;
} else {
echo "Thank you for your submission, someone will be in contact with you soon.\n";
echo "<br><br>\n";
exit;
}
// <---------- THE END ----------> //
Newbie-after form submission return to home page?
Moderator: General Moderators
-
ducatigirl67
- Forum Newbie
- Posts: 22
- Joined: Sun Sep 13, 2009 6:37 pm
Re: Newbie-after form submission return to home page?
Here's an example. $redirect needs to be the url, if it is undefined then you'll get the simple thank you text, if $redirect is defined it will go to the redirected link. You should not echo anything to the browser (no HTML code) before calling the header() function.
edit: removed urlencode, because of stupid %2F
Code: Select all
// if the redirect URL is set: redirect them
$redirect="http://yourdomain.com/thank you sucker.html";
if (isset($redirect)) {
header("Location: $redirect");
} else {
echo "Thank you for your submission, someone will be in contact with you soon.";
echo "<br /><br />";
exit;
}
Last edited by Eric! on Mon Sep 14, 2009 9:28 am, edited 1 time in total.
Re: Newbie-after form submission return to home page?
Don't use urlencode on any part of the URL containing functional slashes if you want them to work.
-
ducatigirl67
- Forum Newbie
- Posts: 22
- Joined: Sun Sep 13, 2009 6:37 pm
Re: Newbie-after form submission return to home page?
I pasted that snippet given to me, and it does not work. Says thankyou.htm not found.
I am VERY VERY new to php.
Can you write it out for me how it will work? Please.
I am VERY VERY new to php.
Can you write it out for me how it will work? Please.
-
ducatigirl67
- Forum Newbie
- Posts: 22
- Joined: Sun Sep 13, 2009 6:37 pm
Re: Newbie-after form submission return to home page?
ahhh I got it, thank you to the last person who posted, I removed the urlencode bit.
I'm rapt!
Thanks
I'm rapt!
Thanks