PHP string no longer recognized after upgrading PHP version

A

Anonymous

Guest
Hello-

This is a novice question which should be easily answered by the pros on this board.

My server was using PHP version 5.2, and today I upgraded it to 5.4. After the upgrade, I discovered a problem with my code.

I have a registration form that sends the submitted data to my email address. My code was putting the e-mail address of the person submitting the form into the subject line of the e-mail that was being delivered to me. Here is the code that generated the subject line:

Code:
$from = "00-00-00 $email" ;

The 00-00-00 part is just a date that I manually change in my code from time to time.

After upgrading to PHP 5.4 today, the email string is no longer appearing in the subject of the email. Now, it just appears as "00-00-00 $email"

Is there something simple that I need to change here to make it work again? Thanks for any help that can be offered!
 
There's nothing wrong with the line that you have posted, try this line just before the line you posted:
Code:
echo "E-mail address: $email <br>Can you see it?";
exit;

and see what is displayed, then backtrace it to the problem. But really you should be upgrading a an even more recent version of PHP as the version you have 'upgraded to' has reached its end of life.
 
I don't see the e-mail address appear when I add that bit of code. But I don't understand what I need to do to "backtrace" the problem. Before upgrading, the code worked just fine. I don't understand what the problem is. If nothing is wrong with the syntax (which I thought might have changed in the new PHP version), then what could be the problem?
 
Something is changing the $email variable or putting it out of scope, you need to go back up through the listing to where it is first declared and see where the variable is changed, e.g.

Code:
$email = 'dorris@summer.com';
echo $email, 'line 2<br>';

....

if ($email = 'fencepost@summer.com') { // line 437
  ......
}
.....
echo $email, 'line 624<br>';

So you find that $email is no longer "dorris@summer.com", and you go through the listing to find line 437 changes it.
 
Back
Top