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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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