aeafisme23 Posted May 20, 2008 Share Posted May 20, 2008 So i have created a form that easily adds/edits/deletes to a database except for the fact i cant update any of my checkboxes to the databases, only my input fields get updated. I just want the selected input to just update in the database under its field name/value to either be yes or no is sufficient enough. I'll give you my code and then a few of what i was thinking might be the problem, really interested in understanding this // this input addresses updates to database but the typeii checkbox does not updated and leaves the db blank <tr valign="baseline"> <td align="right" nowrap><div align="left">Address:</div></td> <td><input type="text" name="address" value="<?php echo $address ?>" size="32"></td> <td> </td> <td align="right" nowrap><div align="left">City:</div></td> <td><input type="text" name="city" value="<?php echo $city ?>" size="32"></td> </tr> <td colspan="2" align="right" nowrap> <div align="left"> <input <?php if (!(strcmp("yes","no"))) {echo "checked=\"checked\"";} ?> type="checkbox" name="typeii" value="<?php echo $typeii ?>" id="checkbox2"> Type II (Conventional Anodize)</div></td> Should i be more concerned with how each checkbox has its own id of checkbox(1,2,4,5,etc...) ex) id="checkbox2" ? and do a php echo of the vlue of checkbox2 and not my own determined name for it as typeii? <input type="checkbox" name="typeii" value="<?php echo $typeii ?>" id="checkbox2"> Quote Link to comment Share on other sites More sharing options...
aeafisme23 Posted May 20, 2008 Author Share Posted May 20, 2008 if ($typeii != NULL) { $typeii = "YES"; } else { $typeii = "NO"; }?> and then i made input box <input type="checkbox" name="typeii" value="<?php echo $typeii ?>"> and it works, i guess i just needed to go at it harder. Thought i would at least give the community a solved so someone can benefit besides me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.