Possible Duplicate:
To retrieve value from a text box in a form (view) to controller in codeigniter php on selection of selectbox
view code
<td align="left" valign="middle" bgcolor="#FFFFFF" class="rows">
<label>
<select name="select<?=$i;?>"><option value="">NO</option><option value="<?=$row ->product_name;?>,<?=$row->barcode?>">YES</option>
textbox code
<td align="left" valign="middle" bgcolor="#FFFFFF" class="rows"><input type="text" name ="Quantity"/></td>
Controller code
function cartoutput() {
$category = $this->input->post('Category');
$num = $this->input->post('numOflimit');
$productName = $this->input->post('product_name');
$barcode = $this->input->post('barcode');
$quantity = $this->input->post('Quantity$i');
//$values = $this->input->post('$i');
echo $quantity;
for ($x = 1; $x <= $num; $x++) {
$userArray = $_POST["select" . $x . ""];
}
$userArray = split(',', $userArray);
$productName = $userArray[0];
$barcode = $userArray[1];
$quantity = $userArray[2];
$flag = $this->cartmodel->productCategory($category);
}
}
how to fetch the respective textbox value according to selected selectbox and provide it in controller
You are never recalling the POSTed value of quantity
.
What happens if you do:
$quant = $this->input->post('quantity');
var_dump($quant);
精彩评论