Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8330197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:02:53+00:00 2026-06-09T02:02:53+00:00

hi all i have page that has two buttons, one should allow the person

  • 0

hi all i have page that has two buttons, one should allow the person go to the add page and continue adding to the database otherwise if they click the other button it goes to the index page.

currently they both just add the entered information into the database and refresh the page, so when a person clicks the type_2 button they aren’t being taken to the index page.

here is the if statement in controller

if ($this->Field->save($this->request->data)) 
{ 
    if($this->params['form']['type_1'] == 'type_1') 
        { 
            $this->Session->setFlash('The field has been saved');  
            $this->redirect( array('controller' => 'Fields','action' => 'add'));
        } 
        else if($this->params['form']['type_2'] == 'type_2') 
        { 
            $this->Session->setFlash('The template has been saved'); 
            $this->redirect( array('controller' => 'Templates','action' => 'index'));
        } 


}

here is the view

<?php

echo $this->Form->create('Field', array('action'=>'add'));


    echo $this->Form->create('Field', array('action'=>'add'));
    echo $this->Form->input('name', array('label'=>'Name: '));
    echo $this->Form->input('description', array('label'=>'Description: '));
    echo $this->Form->input('templates_id', array('label'=>'Template ID: ', 'type' => 'text'));//this would be the conventional fk fieldname
    echo $this->Form->button('Continue adding fields', array('name' => 'type', 'value' => 'type_1'));
    echo $this->Form->button('Finish adding fields', array('name' => 'type', 'value' => 'type_2'));
    echo $this->Form->end();


?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:02:55+00:00Added an answer on June 9, 2026 at 2:02 am

    had to use request instead of params

    if ($this->Field->save($this->request->data)) 
    {  
        if($this->request->data['submit'] == "type_1") 
            { 
                $this->Session->setFlash('The field has been saved');  
                $this->redirect( array('controller' => 'fields','action' => 'add'));
            } 
            if($this->request->data['submit'] == "type_2") 
            { 
                $this->Session->setFlash('The template has been saved'); 
                $this->redirect( array('controller' => 'templates','action' => 'index'));
            } 
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database that has two tables, one of which contains a foreign
Afternoon All, I have two buttons on my web page that is used to
I have a Django project that, on one page, has multiple forms (in different
I am facing a critical problem. I have a page that has two parts.
I have a master page that has two content sections like this (left some
I have three pages that has forms on them. They all lead to one
I have a work page that shows all projects. I am using a taxonomy
I have a index.php page that is the main page. All pages are included
I have a page with a few links that are all like this: <a
I have an intermediary class extending System.Web.UI.Page for all of my pages that require

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.