![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
php form header location problem
hi
i've got a form on a webpage http://www.domain.com/contact.htm but when it is submitted rather than the page redirecting to the thanks.htm page, the thanks.htm page just shows up on top of the contact.htm page. any idea what i'm doing wrong? btw the form does send the email its just this redirection that is a problem. below is the code i'm using. if($send) {header("Location: http://www.domain.com/thanks.htm"); exit(); } else {print "We encountered an error sending your mail"; } exit(); } anyone got any ideas? thanks in advance |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Feb 2011
Location: Ontario, Canada
Posts: 1,026
|
Hard to tell with what you posted, would have to see the form and rest of the page(s).
I cleaned this up a bit: Code:
if(isset($send)) { header("Location: http://www.domain.com/thanks.htm"); } else { echo "We encountered an error sending your mail"; } // Everything below this is useless unless there is more code not shown. exit(); }
__________________
[email protected] ICQ: 269486444 ZoxEmbedTube - Build unlimited "fake" tubes with this easy 100% unencoded CMS! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
I'm just off to bed but i'll give that a try in the morning. Thanks for your help
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Feb 2011
Location: Ontario, Canada
Posts: 1,026
|
The code should do the same thing, I didn't really change anything overly important, just easier to read. Would have to see the rest of your stuff to see the issue.
__________________
[email protected] ICQ: 269486444 ZoxEmbedTube - Build unlimited "fake" tubes with this easy 100% unencoded CMS! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
So Fucking Banned
Industry Role:
Join Date: Sep 2010
Posts: 3,405
|
Actually it's good practice to have an exit after a header redirect, as in the code he posted, and you removed it. Also why did you add isset?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Feb 2011
Location: Ontario, Canada
Posts: 1,026
|
Yep, I wasn't really thinking.
__________________
[email protected] ICQ: 269486444 ZoxEmbedTube - Build unlimited "fake" tubes with this easy 100% unencoded CMS! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Nov 2005
Location: Seattle, WA
Posts: 510
|
need to see entire code...
__________________
ICQ: 275335837 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
frc
Industry Role:
Join Date: Jul 2003
Location: Bitcoin wallet
Posts: 4,663
|
Haven't see the exact problem before - but strange things happen if you have anything (even a space or line-break) before the header redirect. It has to be the FIRST thing sent to the browser.
__________________
Crazy fast VPS for $10 a month. Try with $20 free credit |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
ORLY?
Industry Role:
Join Date: Oct 2005
Location: NL & US
Posts: 2,579
|
Quote:
$send is probable $_POST['send'] unless you have register_globals = on which you really shouldnt :-) Edit; Just thought of that $send might be the return of the mail(); function, in that case ignore my reply. You say you want to include the thanks.html code at the top of your form, yet you use a header('location: ') statement. You are probably looking for an include('url'); statement no? |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: May 2008
Posts: 3,406
|
He/She probably has
if (Form is Good) $send = 1; else $send = 0; or something to that effect above this code? So you wouldn't want to do isset, the if ($send) is better |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Join Date: Jun 2003
Posts: 1,697
|
Quote:
Your first if($send) doesn't do anything. Like Zoxxa pointed out, it has to be either if(isset($send)) or if("$send" == "something") ![]()
__________________
Sell our Silicone Dolls and make big money! Our website: https://www.sexdolls-shop.com/ Signup: http://www.sexdollscash.com/sliiing/registration.php Contact: [email protected] |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
hi guys
thanks very much for all the advice. i've added the isset although that didn't help my problem. i'm not sure if i explained it very well. upon succesful form submit i want the surfer to be redirecte3d to the thanks.htm page. however currently rather than redirect the thanks.html page weirdly lays on top of the contact htm page so that you can see both in the same window. this is the code i'm using PHP Code:
can anyone see what's wrong with my code? thanks in advance |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Join Date: Jun 2003
Posts: 1,697
|
Your code is not secure by the way. It may cause you issues. People could use your email script to spam others using your server. Your have to filter your POST variables
Here is what you are looking for: if($send === TRUE) {header("Location: http://www.mydomain.com/thanks.html"); exit(); }
__________________
Sell our Silicone Dolls and make big money! Our website: https://www.sexdolls-shop.com/ Signup: http://www.sexdollscash.com/sliiing/registration.php Contact: [email protected] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
thanks, that still gave the same error, not sure why. i've now given up and i'm modifying someone elses form (which is more secure). thanks again
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
|
Roly, your error is not an error, it's a notice. You can turn down the error reporting level in php.ini. Your header redirect isn't working because the error is outputting before the header() line, and you cannot send anythign to the output buffer before header().
ini_set('display_errors', 'Off');
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 | |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
Quote:
understood, although that variable wasn't getting passed which was the problem. i added the error reporting to try and help diagnose my problems. anyhow i gave up on this and i've got something else working now. thanks anyway |
|
![]() |
![]() ![]() ![]() ![]() ![]() |