Jump to content

Recommended Posts

Hello Everyone!

First off, big thanks to everyone who's helped me in the past. I haven't had to post a question for almost half a year!

But now I'm having a retarded problem with something simple.

I have a signup script on my site. The data is collected, analyzed, verified, transformed, transmitted, stored, and everything that happens to user input. So, I have the data just the way I want, stored in a database; I write a nice email to the new user with the message in $message, and the return email address in the $headers var (no user input is stored in the header var). Here is the code at the point in question.

[code]$success = mail($emailTo, $subject, $message, $headers);

header("Location: http://www.ebay.com");
die();[/code]

I receive the email perfectly, every time, just as expected, but then the browser stops at a blank screen. I used ebay as a pointer so I can see if it is working. The Browser is not redirected. I've tried changing die(); to exit(); and still no good.

I'm slightly confused. I've set up header redirects before but this one doesn't work. It seems that if the script is running fine, sending emails, storing data and everything else, the syntax is ok up to this point.

Am I missing something dumb? or am I just dumb?

Thanks much for the help!

Daniel
Link to comment
https://forums.phpfreaks.com/topic/10218-header-redirection-prob/
Share on other sites

well here's a possibly dumb answer to a possibly dumb question :)

maybe ebay has some kind of "block" of some kind? I only know the basics of the header function so I don't know if that is possible. But, maybe it is? Have you tried putting in some other url, like say, to another page in your own site?
[!--quoteo(post=376167:date=May 22 2006, 03:57 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 22 2006, 03:57 PM) [snapback]376167[/snapback][/div][div class=\'quotemain\'][!--quotec--]
maybe ebay has some kind of "block" of some kind?[/quote]

Brilliant Idea! But it still didn't work :( I thought that would do the trick, as before that I tried only paths (/accounts/home or ../index.php) but even the full http url to my home page didn't work.

And before anyone asks, yes, I did lots of searches, I read the 'Read me first if you have header problems' thread right above this post :) and I tried the things I found, but still no redir. I'm hesitant to post the script as it is about 20k, but I will if its requested.

Thanks so far!

Dan
Gah, I'm so confused

Here's the code now:

[code]$success = mail($emailTo, $subject, $message, $headers);

echo "I'm going to forward right now";

header("Location: http://www.personalizedhomepage.com");
die();

echo "You can't see me";[/code]

And when I run it I get a blank page with "I'm going to forward right no" in the corner. Not even a headers already sent error. The last line of course doesn't show up cus the script hits the die();. So, the line before and after the header line run fine, but the header line doesn't seem to.

Any suggestions would be lovely!

Daniel
[!--quoteo(post=376170:date=May 22 2006, 04:26 PM:name=Houdini)--][div class=\'quotetop\']QUOTE(Houdini @ May 22 2006, 04:26 PM) [snapback]376170[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Does it even produce an error? Or even worse does the code echo [b]You can't see me.[/b]?
[/quote]

Hee hee, No. No error whatsoever. I was expecting a "headers already sent" error when I ran this but I can't even code in an error right I guess. And No, lol, thankfully "You can't see me" doesn't appear.

I just have a blank page with "I'm going to forward right now" in the top left corner.

Thanks!

Dan
Once again I've wasted peoples time and this servers forum space.

Well, hopefully someone else will learn from my dumb mistake.

Ok, I copied the header line to the top of the signup page. Right after the <?PHP.

Viola, worked perfectly.

I moved it to right under my require('DBConnection script url'); line and no worky.

So, checked included file and there was a blank line above the <?PHP.

I feel like I should be banned from forums as this happened last time I posted too, something dumb was all that was wrong.

Ah, well, I suppose someday I'll outgrow these dumb mistakes, or at least a few of em.

Thanks much to all you who helped!

Daniel

---I do wonder why I didn't get a 'headers already sent' error... Hmm.... ---
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.