Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

mysql populated checkbox

Community Beginner ,
Aug 11, 2011 Aug 11, 2011

Copy link to clipboard

Copied

Hi


I have an updated form with information coming from mysql, I one section which I want to set up as checkboxes

I have chosen to store the checkbox values in a separate table this holds the foreign keys to two other tables ie:

Tables 

Disciplines  (which holds the descriptions of the disciplines), Events

And 3rd table called EventDisc this will have 3 fields all INT's with 2 foreign keys for Disciplines and Events.

I have a few questions

1.) With this method I will be needing to update two tables ideally within the same form,  is this possible?

2.) I did source some code at this link  http://www.phpbuilder.com/columns/laflamme20001016.php3?page=1 but could not get it working,  does anyone know of any other places for tutorials on  a.) populating checkboxs from a mysql table and then inserting and updating the checkboxes.?

TOPICS
Server side applications

Views

536
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 11, 2011 Aug 11, 2011

Copy link to clipboard

Copied

LATEST

I have the following code that generates all the checkboxes for rows coming from my Discipline table

                              <?php
                                       $discipline_set = finddisciplines();
                                    while ($dislist = mysql_fetch_assoc ($discipline_set)) {
                                        echo '<input type="checkbox" '.$dislist['dis_id']. '"'; ?>
                                        <?php if ((isset ($_POST ['dis_id']) || ($dislist['dis_id']) == $url_eventid ['dis_id'])) {
                                            ?>checked="checked" <?php } ?>
                                            <?php echo '>'.$dislist['dis_description'].'<br />';
                                    } ?>

However, I understand I need to allocate a name to each row from my table to then $_POST them into the table called EventDisc, each checkbox would generate a separate row in EventDisc.  This is as far as I have got so far and not sure how to make the next steps.screen1.jpg

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines