I am working on a form that contains multiple checkboxes (each with its own value). The last checkbox is marked "Other" and, when it is checked, a text input should appear to let the user write his/her own value.

<input name="pVital[]" type="checkbox" id="pVital[]" value="I &amp; O" />I &amp; O<br/>
<input name="pVital[]" type="checkbox" id="pVital[]" value="Daily Weight" />Daily Weight<br/>
<input name="pVital[]" type="checkbox" id="pVital[]" value="Foley Catheter" />Foley Catheter<br/>
<input name="pVital[]" type="checkbox" id="pVital[]" onClick="showHide(whatever);" value="" />Other<br/>
<input name="pVital[]" type="text" id="whatever" style="visibility: hidden;" />

I insert all these values into the same field into database, as an array of strings, using php's implode function:

if ((isset($_POST['pVital']))){
    $spVital = implode(',',$_POST['pVital']);   
}

$insertSQL = sprintf("INSERT INTO admissionorder (VitalSigns) VALUES (%s)",
                      GetSQLValueString($spVital, "text"));

mysql_select_db($database_PPS, $PPS);
$Result1 = mysql_query($insertSQL, $PPS) or die(mysql_error());

This is working fine for insertion, but I encounter a problem in retrieving these checkboxes... with the "other" text input if appropriate.

Can you tell whether record is inserted in the table...Check your table records...and what problem you are facing in retrieving it??
Is it showing any error or the field is blank???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.