Please follow below this code:
function admin_edit($id = null)
{
if(empty($this->data))
{
$where = array('Product.id'=>$id);
$this->data = $this->Product->find($where);
}
if(!empty($this->data))
{
if($this->data->save($this->data))
{
$this->redirect(array('index'));
}
else
{
$this->redirect(array('edit',$this->data['Product']['id']));
}
}
}
admin_edit.ctp
<?php
echo $form->create('Product',array('action'=>'edit'));
echo $form->input('id',array('type'=>'hidden');
echo $form->input('name',array('label'=>'Product name'));
echo $form->submit('Submit');
?>
On Fri, Aug 7, 2009 at 4:13 PM, leafchild <[email protected]> wrote:
>
> URL some page .../id disappeared ?
>
> I have site there are different form pages to organize products.
>
> Some form page such as admin_edit page - URL: ... admin/product/edit/
> 1
> After I submit URL still same either there is an error or not.
>
> However, some form page lose id from URL after submit,
> and showing index error.
>
> for example, URL: ...admin/category/customer/edit/1 -> ...admin/
> category/customer/edit
> ==============================
> if (!empty($this->data)) {
> // empty
> }
> ==============================
> I deleted all the code inside of if statement for taking care of
> submitting data.
> The one keep same URL doesn't show error but other does.
>
> Not sure difference between these two has.
> I don't know why? Does anyone know what's the issue?
> >
>
--
Regards,
Mohammad Arif Hossen
Web Developer
United Group International(UGIBD)
www.ugibd.net
Mobile no: +88 01714355911
Mobile no: +88 01922110308
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---