The switch statement that I used before on Version 4.0.6 is not working on the new version 4.2. What alternatives can I use that will produce the same result.
Here's the code:
I'm getting this message : Undefined variable: action
Thanks.
Code: Select all
<?php
$PHP_SELF = $_SERVERї'PHP_SELF'];
function index(){
$PHP_SELF = $_SERVERї'PHP_SELF'];
?>
<form action="<?php echo $PHP_SELF ?>" method="POST">
<input type="hidden" name="action" value="submit"
<p>Input a word <input type="text" size="20" name="you_wrote">
<input type="submit" name="submit" value="submit"></p>
</form>
<?php
}
function verify(){
echo("You wrote ".$_REQUESTї'you_wrote']);
}
switch($action){
case "submit":
verify();
break;
default:
index();
break;
}
?>