lupld Posted June 14, 2007 Share Posted June 14, 2007 ok, I have come a long way on my own with php.... that said... I don't even know what to call it to look this part up... First, what is it called when you use something like "index.php?data=something" to handle information? Second, what do you use to process data from it... for example data from a form is $data = $_POST['data'] but what would I use with that... The first question should point me in the right direction, but if anyone wants to explain the whole thing for me, that'd be cool... I just need to know how to get it into a variable... Thanks Quote Link to comment https://forums.phpfreaks.com/topic/55527-solved-help-with-phpdata/ Share on other sites More sharing options...
pocobueno1388 Posted June 14, 2007 Share Posted June 14, 2007 That would be called using the $_GET method. Say you had the URL: www.yoursite.com/index.php?data=12345 You could use this code to get the data: $data = $_GET['data']; Then if you printed that, like this: echo $data; That would print "12345". You could use this information the same way you would use POST information. The only difference is it is stored in the URL, and POST data is hidden. So be careful and not to use things in the URL that you don't want people to see, such as passwords and such. Quote Link to comment https://forums.phpfreaks.com/topic/55527-solved-help-with-phpdata/#findComment-274360 Share on other sites More sharing options...
lupld Posted June 14, 2007 Author Share Posted June 14, 2007 sweet, thanks... I'm just using it to let people click on a username to get aim and yahoo info for that person... no passes... Quote Link to comment https://forums.phpfreaks.com/topic/55527-solved-help-with-phpdata/#findComment-274362 Share on other sites More sharing options...
bonaparte Posted June 14, 2007 Share Posted June 14, 2007 When the URL is something like "index.php?data=something", You can use the $_GET PHP predefined variable to collect data from the URL. Example, <?php $data = $_GET['data']; echo $data; // Or store this somewhere ?> The above script would display something on the web page. If the form method used is POST you would not see the ?data=something part of the URL. It would just be index.php. You could use $data = $_POST['data'] to capture the information posted by a form. You would want to read more about form processing in PHP. The below links provide more information http://php.net/language.variables.predefined http://www.w3schools.com/html/html_forms.asp http://php.net/manual/en/tutorial.forms.php Quote Link to comment https://forums.phpfreaks.com/topic/55527-solved-help-with-phpdata/#findComment-274363 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.