Welcome Guest, Not a member yet? Register   Sign In
How to use the variable passed from form_open?
#1

[eluser]Katsune[/eluser]
Hey guys,

View named printdog.php
Code:
<?php
   $idFromPrintDog = $records['id'];

   echo form_open('mainController/deleteRecord',$idFromPrintDog);
   echo form_submit('','Submit');
   echo form_close();
?>
Controller named mainController
Code:
public function deleteRecord($idFromPrintDog){
echo $idFromPrintDog;
}

Can you guys tell me why I'm getting "missing argument and undefind variable"? Am I calling the value from the view correctly?
I've been checking the documentation but there's no controller example on in the topic for form helper.
#2

[eluser]Tpojka[/eluser]
Second argument in form_open() function should be an associative array (if needed).
Check one more time form helper in user guide.
You should be able to solve this concatenating, so instead comma use dot:
Code:
<?php
   $idFromPrintDog = $records['id'];

   echo form_open('mainController/deleteRecord/' . $idFromPrintDog); //check this line
   echo form_submit('','Submit');
   echo form_close();
?>
#3

[eluser]Katsune[/eluser]
Thank you very much, I tried it earlier too but the page was blank, i thought it was an error,. you're awesome,.




Theme © iAndrew 2016 - Forum software by © MyBB