Re: var check not working...
| From: | Jas | Date: | Mon, 15 Dec 2003 18:10:42 +0000 |
| Subject: | Re: var check not working... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172748@lists.php.net to get a copy of this message | ||
Sven wrote:
Jas schrieb:JasFor some reason this will not work... my $_POST variables check for no form variables and display a form... if they choose an item from a select box it queries the database for a field matching the $_post var and builds a new form creating 8 separate $_post variables to check for.. so far it works except when selecting an item from the select box it will only display the first form when there are $_post vars present. I think I am missing something, could someone look over my code? Thanks in advance, Jas function vlans_dhcp() { $lvl = base64_decode($_SESSION['lvl']);hi jas, the problem is, that your second form is only executed if your first condition is false (else if). but because of your or condition (||) only one of them has to be true. right? right! so it doesn't matter if your $_POST['dhcp_vlans'] is not set, when any other isn't set. a solution might be: <?phpif ($lvl != "admin") { $_SESSION['lvl'] = base64_encode($lvl); $_SESSION['msg'] = $dberrors[12]; call_user_func("db_logs"); } elseif ($lvl == "admin") { $_SESSION['lvl'] = base64_encode($lvl); if (($_POST == "") || (!isset($_POST['dhcp_vlans'])) || (!isset($_POST['sub'])) || (!isset($_POST['msk'])) || (!isset($_POST['dns01'])) || (!isset($_POST['dns02'])) || (!isset($_POST['rtrs'])) || (!isset($_POST['vlans']))) { create 1st form with dhcp_vlans as $_post var....; } elseif (($_POST != "") || (isset($_POST['dhcp_vlans'])) || ($_POST['dhcp_vlans'] != "--------------") || (!isset($_POST['sub'])) || (!isset($_POST['msk'])) || (!isset($_POST['dns01'])) || (!isset($_POST['dns02'])) || (!isset($_POST['rtrs'])) || (!isset($_POST['vlans']))) { create 2nd form based on dhcp_vlans $_post var and create 8 different $_post vars...; } elseif (($_POST != "") || (!isset($_POST['dhcp_vlans'])) || (isset($_POST['id'])) || (isset($_POST['sub'])) || (isset($_POST['msk'])) || (isset($_POST['dns01'])) || (isset($_POST['dns02'])) || (isset($_POST['rtrs'])) || (isset($_POST['rnge'])) || (isset($_POST['vlans']))) { now put 8 $_post vars in database...; } else { $_SESSION['lvl'] = base64_encode($lvl); header("Location: help.php"); } } else { $_SESSION['lvl'] = base64_encode($lvl); $_SESSION['msg'] = $dberrors[12]; call_user_func("db_logs"); }}if ( $_POST == "" || ( !isset($_POST['dhcp_vlans']) && !isset($_POST['sub']) && !isset($_POST['msk']) && !isset($_POST['dns01']) && !isset($_POST['dns02']) && !isset($_POST['rtrs']) && !isset($_POST['vlans']) ) )?> hth SVEN Yah I figured that out.. those operators always throw me off... Thanks again.