MySQL Forums
Forum List  »  Newbie

Re: Checkboxes
Posted by: Sage Adams
Date: August 15, 2005 05:24PM

I tried the code you posted, although I didn't understand it, and it didn't work for me.

Here's the way I'm going about the ready_for_enrollment field right now:

First I set it to a variable using a while statement:

while ($row = mysql_fetch_array($result)) {

...several rows here...

$ubd3_notes = $row['ubd3_notes'];
$ready_for_enrollment = $row['ready_for_enrollment'];
}

Then, in the actual form where it's supposed to show if the box is checked or not I have the following form code:

<input type="checkbox" name="ready_for_enrollment" id="ready_for_enrollment" value="yes"
<? if ('$ready_for_enrollment'=='yes') { echo ' checked '; } ?>>

Finally, as part of the SQL UPDATE clause in the processing page I have the following code:

$sql = "UPDATE $table_name SET

...some more fields here...

ubd3_notes = '$_POST[ubd3_notes]',
ready_for_enrollment = '$_POST[ready_for_enrollment]'
WHERE date_id = '$_POST[date_id]'";


However, when I click the submit link I get the following error message when the box is NOT checked:

Undefined index: ready_for_enrollment in ... on line 68

And when the box IS checked it just doesn't save it as checked.

Any more suggestions?

Thanks,
S./

Website:
http://www.villainsvalley.net/

Options: ReplyQuote


Subject
Written By
Posted
August 12, 2005 06:33PM
August 13, 2005 10:46AM
Re: Checkboxes
August 15, 2005 05:24PM
August 16, 2005 11:24AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.