helloise Posted January 4, 2011 Share Posted January 4, 2011 i have an html form which is a "post" on it i have an array of checkboxes and a sumbit button, once button is clicked i go to another page where i handle those boxes checked the problem now is if NO checkboxes are checked and i hit the submit...i get errors on the other page my code: foreach($product_names as $product_row) { ?> <tr> <td > </td><td width='200px'><?php echo $product_row->getName(); ?></td> <td width='200px'><input type="checkbox" name="graphic[]" value="<?php echo $product_row->getId();?>" /></td> <td width='200px'><input type="checkbox" name="text[]" value="<?php echo $product_row->getId();?>" /></td> </tr> <?php } ?> </table> <table> <tr> <td> <input type='submit' name='submit' value='Submit'> <?php if ( (isset($graphic)) || (isset($text) )) { echo "checkboxes checked"; //show submit button } else { //hide submit botton and echo "no boxes check"; } ?> the above is NOT working please help???? Link to comment https://forums.phpfreaks.com/topic/223353-show-submit-button-only-if-checkbox-is-checked-issue/ Share on other sites More sharing options...
revraz Posted January 4, 2011 Share Posted January 4, 2011 Posting the errors sure helps Link to comment https://forums.phpfreaks.com/topic/223353-show-submit-button-only-if-checkbox-is-checked-issue/#findComment-1154601 Share on other sites More sharing options...
helloise Posted January 4, 2011 Author Share Posted January 4, 2011 i fixed it now...but just one last thing when the page opens then obviously no boxes are checked...and i get my message "no boxes check", i want the submit button greyed out then: as soon as i check a box i want the submit button to UN grey i will have to some how loop through graphic[] array but have no clue how can you pls help me wth the code pls? thanks Link to comment https://forums.phpfreaks.com/topic/223353-show-submit-button-only-if-checkbox-is-checked-issue/#findComment-1154616 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.