当前位置: 动力学知识库 > 问答 > 编程问答 >

receive post information with codeigniter

问题描述:

I have an order form with data. on submit the controller function new_blank_order_summary is called.

the syntax for this is:

 function new_blank_order_summary()

{

echo "orderlines: ".$this->input->post(orderlines);

echo "customer: ".$this->input->post('customer');

echo "period: ".$this->input->post('period');

echo "creditlimit: ".$this->input->post('creditlimit');

$this->load->view('sales/new_blank_order_summary');

}

I cannot get the post information to display or echo? my input Name and ID is orderlines but this is not being posted or received properly.

Apologies for the 'stupid' question.

any advice welcome.

HTML

<form id="sales_blank_order_details" action="/sales/new_blank_order_summary" method="post">

<table >

<tr><td>Customer</td><td>Period</td><td>UoM</td><td>Credit Limit</td><td>Balance</td><td>New Balance</td><td>Order Lines</td><td>Round to Bundle</td></tr>

<tr><td>

<input type="text" name="customer" id="customer" value="<?php echo $customer; ?>" disabled>

</td><td>

<input type="text" name="period" id="period" value="<?php echo $period." to ".$newperiod; ?>" disabled>

</td><td>

<input type="text" name="buom" id="buom" value="<?php echo $buom; ?>" disabled>

</td><td>

<input type="text" name="creditlimit" id="creditlimit" value="<?php echo $creditlimit['creditlimit']; ?>" disabled>

</td><td>

<input type="text" name="currentbalance" id="currentbalance" value="<?php echo $creditlimit['currentbalance']; ?>" disabled>

</td>

<td>

<input type="text" name="newbalance" id="newbalance" value="<?php echo $creditlimit['currentbalance']; ?>" disabled>

</td><td>

<input type="text" name="orderlines" id="orderlines" value="1" disabled>

</td><td>

<input type="checkbox" name="rounduptobundle" id="rounduptobundle" checked>

</td></tr></table>

<input type="submit" name="blank_order_lines" id="blank_order_lines" value="Save Order and Proceed">

</form>

None of these posts are outputted by controller.

网友答案:

You've disabled the orderlines text input field so that's why it will not get posted. Remove disabledand it will show up in $this->input->post().

网友答案:

what is the name and value of your submit button. Usually the name of my submit button is name="submit" and the value is value="submit". So then I try $this->input->post('submit')=='submit'. try this in your if condition. I hope it will work. best of luck.

网友答案:
function new_blank_order_summary() 
{
      echo "orlderlines: ".$this->input->post('orderlines');
      echo "customer: ".$this->input->post('customer');
      echo "period: ".$this->input->post('period');
      echo "creditlimit: ".$this->input->post('creditlimit');   

      $this->load->view('sales/new_blank_order_summary');

}

Please try this code. I didn't change a single line in it. Only I put the single quotes in the 3rd line. And, changed it's variable name is wrong so I changed it

分享给朋友:
您可能感兴趣的文章:
随机阅读: