Is the $formulaId being passed in through the URL? If so, I believe that the $formulaId variable is only available in your action when the page is first requested via the get request. Once the page is submitted with the form and it's doing a post request it no longer has $formulaId being passed in through the URL at that point. It's passing in the form data to the edit action not the URL data.
Try just redirecting to a static page like a home or contact page after the save to see if the redirect works or if its the ID that you're passing to it is the error. I'm not sure why it's taking you to an entirely different URL though. On Mar 1, 7:43 pm, bbowler86 <[email protected]> wrote: > So I have a materials controller and I am trying to save the weight of a > material and then redirect to the instructions action in the formulas > controller. I know its getting to the > > if($this->request->is('post')) { > > IF/Then construct because I have put echoes in it but after it saves it > ends up not redirecting and just goes to a blank page where the URL is > > /formulas/edit/2 > > which makes it seem like its just truncating the formulasId from the URL. > When it gets to that point it shows up blank and when I view > > Here is my code below: > > function edit($id = null, $formulaId = null) { > $this->Formula->id = $id; > $this->Formula->formulaId = $formulaId; > $this->set('formulasId', $this->Formula->formulaId); > if($this->request->is('post')) { > $this->Formula->save($this->request->data); > $this->redirect('/formulas/instructions/' . $formulaId); > > } > if($this->request->is('get')) { > debug($this->data); > $this->request->data = $this->Formula->read(); > } else if($this->Formula->save($this->request->data)) { > $this->redirect(array('action' => 'instructions', $formulaId)); > } > } > > My view is: > > <?php > echo $this->Form->create('Formula', array('action' => 'edit')); > echo $this->Form->input('weight'); > echo $this->Form->input('id', array('type' => 'hidden')); > echo $this->Form->input('formulasId', array('type' => 'hidden')); > echo $this->Form->end('Save');?> -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
