Web Tutorials » Query Strings
Submitted By: Ccucu

This tutorial aplies to anything like page.php?var=stuff&var2=stuff. Let me define a few terms to start: 'query string' is the ?page=blah part in 'page.php?page=blah'. page=blah is called a variable=value pair. You can seperate them by doing 'page.php?var1=bob&var2=tom'.

Now, something that will cause many of you problems is register_globals. If its off (which it is by default in the last few php distrubs), using $queryStringVar when going to page.php?queryStringVar=tom wont print out anything. In fact, chances are it will give you an unset / undefined variable error... whcih isnt good! But we have a soultion.

Remember the variable=value pairs? We can get things from the query string through the $_GET array, no matter what. So since $queryStringVar doesnt work, we have to get it through $_GET['queryStringVar'].

 

 
Related Ebooks/Softwares
» Poll
You must login or register to make submit comments.
Comments
 
Username:
Password:
 
Sign Up | Lost Password
 
 

Execution time : 0.0243339538574