|
Posted by macca on 09/23/07 08:41
Depends where you are getting our 'activator':
If it's an action based on a submitted for variable you may do
something like this
<?php
if (isset($_POST['form_variable'])){
// more code
}
?>
This snippet will run only if the 'form_variable' input is submitted
as a HTTP post var.
------------------------------------------
OR if you wanted to display someones name if their name is "Ted"
<?php
$name = "Ted";
if ($name == "Ted"){
// do this
}
?>
This snippet will only run if $name is "Ted", otherwise does nothing.
-------------------------------------------
OR using a Boolean
<?php
$boolean_var = FALSE;
if ($boolean_var){
// do this
}
?>
This snippet will not run because $boolean_var is false. If it was
true it would.
--------------------------------------------
In the last example it is not necesarry to write if ($boolean_var ==
TRUE).
All these examples will only do something if the condition equates to
true, otherwise will do nothing.
Hope this helps,
Regards,
Paul.
Navigation:
[Reply to this message]
|