There... Now you are wondering how does that work. Whatever you make the name of the form the value makes the variable set on the next page. I added $_POST[''] around the variable so it knew to get the data from a method on named post. in <form we added method='post' you can make it method='get' also. Which basically means you put $_GET[''], the difference is post is run hidden. Get puts all the variables in the url and gets the data from the url in other words for sites that have something.php?id=61102 to get the id you use $_GET['id'] it is just 2 different ways of putting the data to the next page. Most people like the post way to hide data like passwords but others like to show it to make there URL look cooler plus so people can send the url to a friend and it will automatically process the data. For instance if you made a script that calculated just using url you could make a file like:
Then all you have to do is go to calculator.php and in url put: calculator.php?data=5+5-8*1/8 which will output: 0.25 on the page.
now to go back to the old method "post" you could make a form and on the page make a text box called "to" and someone put there eMail address there.Now on the page that the form sends the data to
just make it print $to and it will print what they typed. Now if you wanted to use what I said on the mail() tutorial you could do something like make a html
form then make the names... to, subject, body. then on the next page type: mail($to, $subject, $body, "From: My Feedback"); and you just made a feedback. Now
your probably wondering how does the html file know where to send the data. Well just change action='' in the <form> to the address of the PHP file and away you go.
There will need to be a few changes to this also. Once the tutorial section is updated we'll move it to a new area. Update it as AlEasy suggested and once the tutorial code is completed I'll either move it there or you can.
I just fixed the tutorial, Thanks for finding the bug. I do that for all my codes but I didn't wanna make it anymore harder for people that are just starting out. I forgot about the problem if register globals were off.