php - work with PHP_SELF -



php - work with PHP_SELF -

it give me error : undefined index: action in line : $act=$_post['action'];

<?php function_2() { ?> <form name="poll" method="post" action="<?php echo $_server['php_self']; ?>"> <input type="hidden" name="action" value="insert"> . . . </form> <?php } $act=$_post['action']; switch($act) { case "insert": function_1(); break; default: fuction_2(); break; } ?>

please help me it.

that error saying $_post['action'] doesn't exist. so, need conditional statement set value of $act.

// set default $act = ''; if ( isset($_post['action'])) ) { $act = $_post['action']; } switch($act) { case "insert": function_1(); break; default: fuction_2(); break; }

php post self

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -