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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.