View Full Version : Array and CheckBox Problem

09-01-2007, 11:42 AM
Hi all ,
i have a php page in which i have few checkboxes loaded from DB and against each checkbox there is a correspondent textbox in which the user enters some data. he can chose any checkbox in any order. i want to map the checkbox to the correspondent textbox e.g. if there are three checkbox ck[1] , ck[2] , ck[3] and if he checks ck[2] then only the textbox correspondent to it should be trapped.
below is my code but i am failing in trapping the checkbox with the correspondent textbox :mad:
my checkboxes and the textbox:
<? foreach($ItemArray as $iarr) { ?>
<td class="datatd"><input type="checkbox" id="Item_ID[]" name="Item_ID[]" value="<?=$iarr['pk']?>"></td>
<TD class="datatd"><input type="textbox" class="smtxtbox" name="AssessmentFormItem_VC[]" value=""></TD>

<? } // end for ?>
<INPUT TYPE="text" NAME="CntItems" value="<?=count($ItemArray);?>">

if ($save) {

if (count($Item_ID)>0) {



$fields_values = array(
"AssessmentFormItem_VC" => $AssessmentFormItem_VC[$j-$a],
"AssessmentForm_ID" => $AssessmentForm_ID,
"Item_ID" => $Item_ID[$j],
"InsertBy_NV" => $sname,
"InsertBy_SI" => $suserid,
"InsertDate_DT" => $CurrentDateTime

} else {


} // end of foreach

} // end save

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum