Jump to content

swtich not working.. help plz


Gayner

Recommended Posts

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 ?

Link to comment
https://forums.phpfreaks.com/topic/184958-swtich-not-working-help-plz/
Share on other sites

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;
   }
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.