How does PHP pick up from check boxes in previous pages? if ($book_spoke="true")? if ($book_spoke="true")//$_REQUEST["Book_Spoke"] { if ($i > 0) { $sql.= " AND "; } //goes through the 3 cycles of spokes $sql.= " ("; for ($re=0; $re<=2; $re++) { $sql.= "book = ".($spoke + 22*$re); if ($re <2) { $sql.= " OR "; } } $sql.= " )"; $i++; } PHP:
if ($book_spoke="true")//$_REQUEST["Book_Spoke"] PHP: You are using assignment operator = in if statement that is not correct. Instead of checking ="true" use following statement. if isset($book_spoke){ // your code.... PHP: Now if visitor will check the checkbox than your if statement will execute. And if checkbox is not checked than you will not receive any value of checkbox on the submitted page
Use this: if ($book_spoke == true) PHP: greatlogix, $book_scope is most likely true or false. Using isset() will still match either of these values. Above poster's code is also wrong as it is matching against the string "true", not the boolean "true", and has a typo.
hmm, i might be missing something, but i dont see any $_POST or $_GET from the posts above(assuming magic_vars is off which is the default and safer way) getting the value of a checkbox is the same as getting the value from any other field, except for an upload field, use the code below $checkboxValue = $_POST['checkbox_field_name']; or $checkboxValue = $_GET['checkbox_field_name'];
His code says: if ($book_spoke="true")//$_REQUEST["Book_Spoke"] PHP: So I'm assuming $book_spoke comes from the $_REQUEST variable. Using isset() is correct in this case though, as we're working with checkboxes. If the box is not checked, it won't be submitted with the form. This means $book_spoke would be null. And isset() returns false on null. Plus, comparing a value to a boolean value like this: if ($book_spoke == true) PHP: ... Is unnecessary, as it will cast the variable automatically to boolean if you use just: if ($book_spoke) PHP: EDIT: To avoid E_NOTICE errors for undefined offsets or variables, I would suggest doing just: if (isset($_REQUEST["Book_Spoke"])) { // Do whatever } PHP:
hehe, thanks for pointing that out nico_swd, that's why i put "i might have missed something", i really dont use $_REQUEST to get my vars because that's almost the same as having magic vars turned on