OMFG.
Posted: Tue Sep 16, 2003 2:26 am
This really got on my nerves. I had a very simply email job to do and I couldn't figure out what was wrong.
For developing PHP for more than a year now, I was disapointed in myself...heh. Here is a mock up of the structure of the script:
Now I was playing with this script forever, revision after revision, and the email checker and variable checker portions of the script were not functional AT ALL.
After about the 10th rewrite of the entire script, I tested something out; instead of forwarding to a thank you page, i would add phpinfo() to see what the settings of the server were.
I added jibberish to the fields thinking it wouldn't matter, and then submit the form. Low and behold; It starts to work. I was puzzled. I didn't even bother to anylize the phpinfo() page, i just re-added the header() function that sends to a thank you page; and tried again.
ERROR! I didn't work. This freaked me out. I went ahead and re-added phpinfo() and tested again. It worked!
Angry, frustrated, and happy all at once i went ahead and added require("thankyoupage.html") instead of the header() forwarding it there. And it works like a charm now.
Now my question is; why did it ignore an entire portion of my script because of that header() function? I've never heard of a problem like this before so I hope some of you veterans can clear this up for me.
btw: the original script worked perfectly on my testing server which runs php 4.1.1. Site that this all happened on has 4.2.3. This script has no HTML on it, it's pure PHP.
For developing PHP for more than a year now, I was disapointed in myself...heh. Here is a mock up of the structure of the script:
Code: Select all
<?php
// check if submit was sent via request method, if not shout error msg
// check to see if email address is valid, if not send to error pg via header()
// check to see if variables are set, if not send to error pg via header()
// set variables for mail and trim incoming variables
// send email, if it was sent, it forwards a user to a thank you page via header(), if not sends to error pg via header()
?>After about the 10th rewrite of the entire script, I tested something out; instead of forwarding to a thank you page, i would add phpinfo() to see what the settings of the server were.
I added jibberish to the fields thinking it wouldn't matter, and then submit the form. Low and behold; It starts to work. I was puzzled. I didn't even bother to anylize the phpinfo() page, i just re-added the header() function that sends to a thank you page; and tried again.
ERROR! I didn't work. This freaked me out. I went ahead and re-added phpinfo() and tested again. It worked!
Angry, frustrated, and happy all at once i went ahead and added require("thankyoupage.html") instead of the header() forwarding it there. And it works like a charm now.
Now my question is; why did it ignore an entire portion of my script because of that header() function? I've never heard of a problem like this before so I hope some of you veterans can clear this up for me.
btw: the original script worked perfectly on my testing server which runs php 4.1.1. Site that this all happened on has 4.2.3. This script has no HTML on it, it's pure PHP.