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

  • SEARCH
  • Home
  • 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 8381173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:38:15+00:00 2026-06-09T16:38:15+00:00

trying to create a form and a confirmation page which asks to confirm if

  • 0

trying to create a form and a confirmation page which asks to confirm if the user wants to create a relationship with a user. The form just has a field which takes an id and directs the user to the confirm page. The confirmation page has two buttons, confirm and deny when a user clicks confirm the form will be submitted to the database, if they user clicks deny the data from the form will be discarded. The confirmation page also will print the username of the user they are trying to add.

I cant seem to retrieve the id from the add page (add_admin.ctp).

How would I access the id from the original add page (add_admin.ctp) to use it in the confirm page (confirm.ctp)?

public function add_admin() {
    $this->set('title_for_layout', 'Send A Relationship Request');
    $this->set('stylesheet_used', 'homestyle');
    $this->set('image_used', 'eBOXLogoHome.png'); 
    $this->layout='home_layout';

    $account_id=$this->User->find('list', array(
    'fields'=>array('account_id'),'conditions' => array(
    'id' => $this->Auth->user('id'))));

    if ($this->request->is('post')) {

      $this->Relationship->save($this->request->data);
      if ($this->Relationship->validates(array('fieldList'=>array('receiver_id','Relationship.accountExists'))))
      {

        $this->Relationship->save($this->request->data);
        $this->Session->setFlash('The relationship has been saved');
        $this->redirect(array('controller'=>'Relationships', 'action'=>'confirm'));
      } else {
        $this->Session->setFlash('The relationship could not be saved. Please, try again.');
      } 
    }
    $this->set('account_id', $account_id);
  }

public function confirm($id){
        $this->set('title_for_layout', 'Relationships');
        $this->set('stylesheet_used', 'homestyle');
        $this->set('image_used', 'eBOXLogoHome.png');   
        $this->layout='home_layout';

        //$id = $this->request->data(`Relationship.receiver_id`);
        //$id = $this->params('Relationship.id');
        $id = $this->params['Relationship']['id'];
        $compName = $this->request->data(`Account.company_name`);

        $findName=$this->Account->find('list', array(
        'fields'=>array('company_name'),'conditions' => array(
        'id' => $id)));

        debug($id);
        pr($compName);
        pr($findName);

        $this->Relationship->unbindModel(array('hasMany'=>array('Invoice')));
        if ($this->request->is('get')) {
        $this->request->data = $this->Relationship->read(NULL, $id);
        }
        else 
        {
            if ($this->Relationship->save($this->request->data)) {

                //$this->Session->setFlash('You have successfully confirmed the relationship.');

                if($this->request->data['submit'] == "type_1") 
                { 
                    $this->Session->setFlash('The relationship has been confirmed');  
                    $this->redirect( array('controller' => 'fields','action' => 'add'));
                } 
                if($this->request->data['submit'] == "type_2") 
                { 
                    $this->Session->setFlash('The relationship was denied'); 
                    $this->redirect( array('controller' => 'templates','action' => 'index'));
                } 

            } else {
                $this->Session->setFlash('Unable to update your post.');
            }
        }
        $this->set('compName', $compName);
        $this->set('findName', $findName);
        $this->set('id', $id);
    }

add_admin.ctp

<?php
echo $this->Form->create('Relationship', array('action'=>'add_admin'));
echo $this->Form->hidden('sender_id',array('label'=>'Enter your eBox ID: ', 'type'=>'text', 'default'=>$account_id)); 
echo $this->Form->input('receiver_id',array('label'=>'Receiver eBox ID: ', 'type'=>'text'));
echo "<br />";
echo $this->Form->end('Submit');
?>

confirm.ctp

Do you want to create a relationship with <?php echo $findName ?> 
    <?php
    echo $this->Form->create('Relationship', array('action'=>'confirm'));
    echo $this->Form->input('id', array('type'=>'hidden'));

    echo $this->Form->button('Confirm', array('name' => 'submit', 'value' => 'type_1'));
    echo $this->Form->button('Deny', array('name' => 'submit', 'value' => 'type_2'));


    ?>
  • 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-09T16:38:17+00:00Added an answer on June 9, 2026 at 4:38 pm

    Add the ID to the redirect:

    $this->redirect(array('controller' => 'Relationships', 'action' => 'confirm'));
    

    To become something like:

    $this->redirect(array('controller' => 'Relationships', 'action' => 'confirm', $this->request->data['Relationship']['receiver_id']));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im a Titanium Beginner who is trying to create a form page with 2
I am trying to create a registration form (just for practice) and saw this
I am trying to create a form through sencha touch that simply takes the
I've been trying to create an order confirmation page for my rails app, and
The problem I'm having is I'm trying to create a form which passes the
I am trying to create a form in drupal 6 that has multiple items
Hi all I'm trying to create a form where a user can create a
I am trying to create a form that serves as confirmation for the destroy
i'm trying to create form which with which i can upload text and image
I'm trying to create a form that has an expandable widget. The problem is

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.