| ★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum5/HTML/002361.html | Nouvelle recherche | Portail wanayoo |
|
|
DevShed Discussion Forums
![]() PHP
![]() checkboxes from a Mysql DB
|
| next newest topic | next oldest topic |
| Author | Topic: checkboxes from a Mysql DB |
|
tigg Member |
I'm creating a page that includes check boxes that are dynamically pulled from a MySQL database. I have gotten it to correctly pull up the boxes and name them, but when I make a change and submit, all of the values that were checked are set to 0 instead of 1. This should print out a checkbox, checked if it is supposed to be, and take an argument to be passed when the user chooses to update the page.
The value 'checked' is passed to another file that updates the db |
|
Shiju Rajan Member |
print "<td valign='top'>"; print "<input type=checkbox name=checkbox_$cat_name value='checked' $checked[$j]></td>"; print ${"checkbox_".$field_name}." !!!"; print "<td valign='top'>$list_cat_name</td>"; tigg, i think you should put value="1" in check box. ie,
------------------ "The fear of the LORD is the beginning of knowledge..." |
|
tigg Member |
That didn't work. I still get nothing but "!!!"s from the statement, so I believe that the problem has to be in the <input> statement In 'values="foo"' foo is the value that is returned when the box is checked. |
|
adossey Junior Member |
I am doing a similar thing in one of my scripts. Here is what I am doing: <input type="checkbox" value="show_email" name="show_email" <? if ($show_email == "show_email") echo "checked"; ?>> This works like a charm! I'm just checking to see if @show_email has already been set, and if so, just output CHECKED, which turns on the checkbox. Hope this helps for you. Alex Dossey |
All times are MST (US) | next newest topic | next oldest topic |
![]() |
|
Copyright © 1997-2000 ngenuity. All rights reserved.
Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.