Jump to content

show submit button only if checkbox is checked issue


helloise

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

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