Welcome Guest, Not a member yet? Register   Sign In
Input hidden
#1

[eluser]the_unforgiven[/eluser]
I have a input hidden field and I want to grab the value in my model

but this doesn't seem to work

Code:
'CustomerID'  => $this->input->post('CustomerID'),

So i tried this

Code:
'CustomerID'  => $this->input->hidden('CustomerID'),

And then got this error:
Quote:Fatal error: Call to undefined method CI_Input::hidden()

What should i do to achieve this?
#2

[eluser]ibnclaudius[/eluser]
This is the correct:
Code:
$this->input->post('CustomerID')

The problem is probably in your input field, post it.
#3

[eluser]the_unforgiven[/eluser]
I have this hidden field
Code:
<?php echo form_hidden('CustomerID', $meeting->CustomerID); ?>

Which output a number lets say 3815 so i need to get that value of 3815 and post it to my model in order to post it to the database
#4

[eluser]the_unforgiven[/eluser]
Also the

Code:
$this->input->post('CustomerID')

Doesn't input into the database, its just inserts a 0 (zero)
#5

[eluser]meigwilym[/eluser]
Check that the hidden field is inside the form elements.

Next, you can check what $_POST data is sent, by using

Code:
var_dump($_POST);

Your hidden field should be somewhere inside it. If it is, then try
Code:
var_dump($_POST['CustomerID');
var_dump($this->input->post('CustomerID'));
die();

Let us know where you get.

Mei
#6

[eluser]ibnclaudius[/eluser]
Hmm... It's ok...

Have you checked the source code to see if is really outputting a value?
#7

[eluser]the_unforgiven[/eluser]
Yes checked source its outputtin a number which is what i need but then need to get that number to post to model to post to db
#8

[eluser]the_unforgiven[/eluser]
[quote author="meigwilym" date="1328046405"]Check that the hidden field is inside the form elements.

Next, you can check what $_POST data is sent, by using

Code:
var_dump($_POST);

Your hidden field should be somewhere inside it. If it is, then try
Code:
var_dump($_POST['CustomerID');
var_dump($this->input->post('CustomerID'));
die();
[/quote]

I did the above and this is what i got when i viewed source.

array(0) {
}
<div>

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message: Undefined index: CustomerID</p>
<p>Filename: views/editclient.php</p>
<p>Line Number: 73</p>

</div>NULL
bool(false)
#9

[eluser]ibnclaudius[/eluser]
Now, try what meigwilym said.

Code:
var_dump($_POST['CustomerID');
var_dump($this->input->post('CustomerID'));
die();
#10

[eluser]the_unforgiven[/eluser]
I have tried what you just posted and get this:

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message: Undefined index: CustomerID</p>
<p>Filename: views/editclient.php</p>
<p>Line Number: 73</p>

NULL
bool(false)




Theme © iAndrew 2016 - Forum software by © MyBB