Welcome Guest, Not a member yet? Register   Sign In
Nice way of getting field values?
#1

[eluser]überfuzz[/eluser]
Is there a fancy pancy way of getting field values from a <form etc.. > in a viewer lets say form.php to a controller email.php. Or is it the old fashion way. I can't find any thing in the user_guide. Is it because there isn't anything or did I mess up the search?

Code:
$message = $_POST['firstname']. " says hello frendo!";
$message .= "You can email me on ".$_POST['email'].".";
$this->email->message($message);
#2

[eluser]daparky[/eluser]
If you are going to be inserting data i just do something like this:-

Code:
$values = $_POST;

$this->db->insert('mytable', $values);

But for email, i think you have to do it the way your doing it.
#3

[eluser]überfuzz[/eluser]
I guess this is the CI-way.
Code:
$this->input->post('name');
#4

[eluser]timaksu[/eluser]
you guess correct.
#5

[eluser]wabu[/eluser]
If you name your form fields like "animal[name]" then "$this->input->post('animal')" gets you your complete animal.

Combine it with something like the following for bonus points. Wink

http://www.krisjordan.com/2008/11/27/dyn...-stdclass/




Theme © iAndrew 2016 - Forum software by © MyBB