开发者

Multiple text box values from {VIEW} on select of select box to be displayed in controller in PHP [duplicate]

This question already has answers here: 开发者_开发技巧 Closed 11 years ago.

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜