Gayner Posted December 13, 2009 Share Posted December 13, 2009 switch($_GET['CODE']) { case '91': $this->do_signature_2(); break; } and my form: <form name="a" action="index.php" method="post"><input type='hidden' name='CODE' value='91' /> why isn't it <input stuff working ? Quote Link to comment https://forums.phpfreaks.com/topic/184958-swtich-not-working-help-plz/ Share on other sites More sharing options...
corbin Posted December 13, 2009 Share Posted December 13, 2009 Errrr.... Have you read your HTML and the PHP code? $_GET but your form method is POST. Quote Link to comment https://forums.phpfreaks.com/topic/184958-swtich-not-working-help-plz/#findComment-976387 Share on other sites More sharing options...
GFXUniverse Posted December 13, 2009 Share Posted December 13, 2009 Yes your method is POST so use $_POST and use if statement instead <?php $code = $_POST['CODE']; if ($code == 91) { $this->do_signature_2(); } ?> Switch is use to select an option from a set of options but if there is one option you can use IF statement. or if switch statement is required so use this <?php $code = $_POST['CODE']; switch ($code) { case 91: $this->do_signature_2(); break; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/184958-swtich-not-working-help-plz/#findComment-976390 Share on other sites More sharing options...
emopoops Posted December 13, 2009 Share Posted December 13, 2009 lol simple mistake hon Quote Link to comment https://forums.phpfreaks.com/topic/184958-swtich-not-working-help-plz/#findComment-976502 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.