Hello.
I am sending the switch statement i use.
Cases 1,2,3 are the results of a selection box that I use in my form.
What I need is NOT to print the values on screen (using the echo command) but save each value to a variable so I can use the value later.
Anybody can help?
Thanks in advance
switch ($tmethod) {
case "1":
echo= "value 1";
break;
case "2":
echo= " value 2";
break;
case "3":
echo= " value 3";
break;
}
switch statement...
Moderator: General Moderators
ah values that come from a form, those you can find in $_POST and $_GET nowadays. You probably want to read the whole section, starting from http://www.php.net/variables
Code: Select all
if (isset($_POSTї'tmethod']))
{
switch($_POSTї'tmethod'])
{
case '1':
$value = "foo";
break;
case '2': // fallthrough
case '3':
$value = "bar";
break;
default:
$value = "default";
}
}