[!--quoteo(post=360480:date=Mar 31 2006, 03:31 PM:name=Chris Coin)--][div class=\'quotetop\']QUOTE(Chris Coin @ Mar 31 2006, 03:31 PM) [snapback]360480[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Thanks alot, This was exactly wut i was missing
i have another question, if i wanted to say something like:
if $name is "something" then (perform this command)
for example in a form:
if the name section of the form is filled out with the name CHRIS then (do this task)
[/quote]
Well that depends on the method so...
if ($_SERVER['REQUEST_METHOD'] == "POST") $name = $_POST['name'];
if ($_SERVER['REQUEST_METHOD'] == "GET") $name = $_GET['name'];
That just setup our variable depending on whether you use method GET or POST, alternatively you could use $name = $_REQUEST['name'];....
if (strtolower($name) == "chris") {
// Do some stuff
} elseif (strtolower($name) == "john") {
// Do something else
} else {
// Do something else because none of our conditions ever got met
}
I use strtolower so the condition is met even if the person typed "ChRiS" in your form. Personally I wouldn't use $name at all. I would just do...
if (strtolower($_POST['name']) == "chris") // Call Function
This assumes you have a function created to perform your tasks and you are using POST method, but this gives you an idea and hopefully answers your question satisfactorily.