Chocolate570 Posted November 28, 2005 Share Posted November 28, 2005 In some php pages, you'll see this:www.domain.com/index.php?variable=valueHow do I access that variable in the php script? I would like to do many things depending on the variable. Thanks in advance.~Chocolate570 Link to comment Share on other sites More sharing options...
Petrucho Posted November 28, 2005 Share Posted November 28, 2005 to accsses the variable you need use the $_GET array, like this:<?php$var = $_GET['variable'];?> Link to comment Share on other sites More sharing options...
Chocolate570 Posted November 29, 2005 Author Share Posted November 29, 2005 Oh, so just like you get the value of a form? So for example, if the page was:w3schools.invisionzone.com/index.php?wierdscale=4<? php$wierd=$_GET['wierdscale']if($wierd==4){echo $wierd;|?>And it would write "4"? Link to comment Share on other sites More sharing options...
Petrucho Posted November 29, 2005 Share Posted November 29, 2005 exactly, and you can try it.. :)it's like you get a value from a form because,when you sending form with the method "get", it send the vars by the address. Link to comment Share on other sites More sharing options...
alzable Posted December 9, 2005 Share Posted December 9, 2005 Yes, you can also send information without it being seen in the url using "$_POST". Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now