Jump to content

php checked checkbox values

Go to solution Solved by Ch0cu3r,

Recommended Posts

Below is an example of how the script used to work.

The values were stored in a cell like: 6, 7, 5, 8


but know they are stored like:


id   | people_id   | people_interests |


1    | 44               | 2                        |

2    | 44               | 3                        |


How do i change this to show checked values from the new table structure:

$query="select people_interests from People where people_id='{$_GET['id']}'";
$qt=mysql_query("SELECT interest_no, interest FROM Interests");
echo "<label class=checkboxclm><input type=checkbox name=people_interests[] value='$interests[interest_no]' $checked> $interests[interest]</label>";


Link to comment
Share on other sites

  • Solution




$people_result = mysql_query($query);
$interest_array = array();
while($row = mysql_fetch_row($people_result )) {
    $interests_array[] = $row[0];
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.

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.