kyalee Posted August 9, 2008 Share Posted August 9, 2008 This is a very newbie question, but I can't seem to find an answer that makes sense to me. Often in scripts, especially mail contact forms, I've seen a construction like this: $name = $_POST['name']; $email = $_POST['email']; At the beginning of the script. Two questions: 1. What is the advantage of doing it that way? If in the form itself, you have the input boxes named 'name' and 'email', why do you need to reset them that way? 2. Do you then have to use the construction $_POST['name'] when using the variable throughout the rest of the script or can you continue to use $name the entire way through? Link to comment https://forums.phpfreaks.com/topic/118923-variables-and-_post/ Share on other sites More sharing options...
thebadbad Posted August 9, 2008 Share Posted August 9, 2008 With register_globals turned OFF, like it should be, you have to retrieve the POST values via e.g. $_POST['name']. Saving that value in $name simply makes it easier to repeat further down the script (i.e. it's easier to type than $_POST['name']). Link to comment https://forums.phpfreaks.com/topic/118923-variables-and-_post/#findComment-612346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.