error77
asked on
CakePhp Submit extra Values
Hi all,
I have a form in a view and I also have some variables which I need to submit.
My view looks like this:
<?php
echo $form->create('Upload',arr ay('type'= >'file', 'url' => 'uploads'));
echo $form->input('0.file',arra y('type'=> 'file','la bel'=>'Ima ge Upload: '));
echo $form->end('Submit');
?>
The above works fine and submits to table but the table has other fields too so I'd like to submit them too.
For example - something like this:
echo $form->input('Upload', array('user_id' => '100'));
The table has also a field called user_id and I'd like to add this.
How can I do this please?
I know the format is not:
echo $form->input('Upload', array('user_id' => '37'));
What would it be ... if possible please?
thanks
I have a form in a view and I also have some variables which I need to submit.
My view looks like this:
<?php
echo $form->create('Upload',arr
echo $form->input('0.file',arra
echo $form->end('Submit');
?>
The above works fine and submits to table but the table has other fields too so I'd like to submit them too.
For example - something like this:
echo $form->input('Upload', array('user_id' => '100'));
The table has also a field called user_id and I'd like to add this.
How can I do this please?
I know the format is not:
echo $form->input('Upload', array('user_id' => '37'));
What would it be ... if possible please?
thanks
ASKER
I agree with you but there's a small issue here.
I have the user_id in a variable and need to add it to the form as a value.
If I used $form->hidden('user_id') .. the added user_id on the left would be null as it's not been assigned yet.
Know what I mean?
I have the user_id in a variable and need to add it to the form as a value.
If I used $form->hidden('user_id') .. the added user_id on the left would be null as it's not been assigned yet.
Know what I mean?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect! Thanks very much :o)
I think $form->hidden('user_id') should do the right thing as long as your model is set up correctly.