Welcome Guest, Not a member yet? Register   Sign In
How to pass data from a view to a controller?

try this

Quote:My controller has the following code:
$project_id = $this->input->post(“ProjectID”);
echo $project_id;

echo "<pre>";
echo "</pre>";

This way you can see all the variables that your form is posting. Maybe in your html the hidden fields are not within your &lt;form&gt;&lt;/form> tags?.?.?

Thanks but I tried that with no results. I do believe I have all the form tags correct:

&lt;title&gt; TRMC T&E S&T &lt;/title&gt;
<h1>Database Update</h1>
Project Details:<br />
&lt;form action="http://abc.ef.com/ll/index.php/updateprojects/update_project" method="post"&gt;

The funny thing is when I make the form viewable it works fine.

Can you post the rendered html view and also the function you are posting to without removing any of the actual code?

Quote:The funny thing is when I make the form viewable it works fine.

what do you mean by this and how is it that you are hiding it?

What I meant is I am using a form_hidden which gives me this problem. Once I change the form_hidden to say form_input then everything works fine. This is why I think there is something wrong with the form_hidden function. I am questioning whether one can pass a value to a controller using $this->input->post coming from a form_hidden function. I am told I should be able to pass a value but it does not seem to work. The value is correct in the html code I show above but yet the post shows nothing. Once I make the form visible like a form_input than the value is captured by the post method and I can view it, modify it, and use it to insert values into my database.

I do it every day. Will you post the html code of your form rendered. from the <from XXX > to the &lt;/form&gt; without taking anything out. (the version with hidden fields) I'm sure we will be able to figure out whats wrong very quickly.

Theme © iAndrew 2016 - Forum software by © MyBB