boondog Posted December 9, 2009 Share Posted December 9, 2009 Please have mercy on the complete newbie. This form handler used to work, then my server guy upgraded to PHP5 and now it only does half the job: $incoming_subject = "Online Offer from $VenueName for $r_Artist"; This doesn't return the venue name or the artist anymore. And the autorespond email doesn't send at all. Any help would be greatly appreciated. Thanks. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/ Share on other sites More sharing options...
cags Posted December 9, 2009 Share Posted December 9, 2009 Wild guess, your old server settings had register_globals enabled. This automatically registers fields from a form as variables which is generally frowned upon because of security implications. To fix it you will have to manually set the variables using the $_POST (or $_GET) array. You could turn register_globals on in your settings if you have access, but as I said it's not recommended. Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/#findComment-974344 Share on other sites More sharing options...
Mchl Posted December 9, 2009 Share Posted December 9, 2009 Probably the script relies on register globals being enabled. Since using register globals is not safe and generally discouraged, you should use $_POST or $_GET array (depending on which method is being used by your form) to fetch this data. See: http://www.php.net/manual/en/language.variables.superglobals.php Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/#findComment-974346 Share on other sites More sharing options...
boondog Posted December 9, 2009 Author Share Posted December 9, 2009 Probably the script relies on register globals being enabled. Since using register globals is not safe and generally discouraged, you should use $_POST or $_GET array (depending on which method is being used by your form) to fetch this data. See: http://www.php.net/manual/en/language.variables.superglobals.php YIKES! Thanks to you and cags for the lightning fast responses. I don't know how to grab the variables via $_GET or $_POST. Is this job something I need to hire someone online to do? If so, who and how much should I have to pay them? (Man, I hate being outside of my element like this.) Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/#findComment-974352 Share on other sites More sharing options...
cags Posted December 9, 2009 Share Posted December 9, 2009 It's a modification you should be able to do yourself, it would take somebody that knows what they're doing a few minutes. Basically if your HTML looks something like this.... <form method="post"> <input type="text" name="surname" /> <input type="text name="firstname" /> </form> With register_globals enabled PHP will automatically create the variables $surname and $firstname for you and store in them the values entered in the field. PHP also puts the variables in an array like so $_POST = array("surname"=>"value here", "firstname"=>"value here"); So basically everywhere in your script where you have $surname you need to substitute $_POST['surname'] instead. That's pretty much all there is to it (but note if you do just do a find/replace you could potential break the strings since "Online Offer from $_POST['VenueName'] for $_POST['r_Artist']" is invalid (enclosing the variable in {}'s would fix that. Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/#findComment-974353 Share on other sites More sharing options...
boondog Posted December 9, 2009 Author Share Posted December 9, 2009 It's a modification you should be able to do yourself, it would take somebody that knows what they're doing a few minutes. Basically if your HTML looks something like this.... (...) So basically everywhere in your script where you have $surname you need to substitute $_POST['surname'] instead. That's pretty much all there is to it (but note if you do just do a find/replace you could potential break the strings since "Online Offer from $_POST['VenueName'] for $_POST['r_Artist']" is invalid (enclosing the variable in {}'s would fix that. Aha, I get it. So, in the code for the email subject, instead of $_POST['VenueName'] I need to put {$_POST['VenueName']} ... and the rest of the fix is to replace each $_FormVariableName with $_POST['FormVariableName'] By golly, I'll try it. Thanks a heap. Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/#findComment-974369 Share on other sites More sharing options...
Mchl Posted December 9, 2009 Share Posted December 9, 2009 So, in the code for the email subject, instead of $_POST['VenueName'] I need to put {$_POST['VenueName']} Not only there, but in all places where variables are used in double quoted "" strings. Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/#findComment-974374 Share on other sites More sharing options...
boondog Posted December 10, 2009 Author Share Posted December 10, 2009 Not only there, but in all places where variables are used in double quoted "" strings. Success! Thanks a million. Now I sleep. Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/#findComment-974596 Share on other sites More sharing options...
Mchl Posted December 10, 2009 Share Posted December 10, 2009 Good job! Link to comment https://forums.phpfreaks.com/topic/184558-simple-php4-to-php5-tweak/#findComment-974605 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.