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 8587449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:34:19+00:00 2026-06-11T22:34:19+00:00

im creating a page that when a user adds a message to the database

  • 0

im creating a page that when a user adds a message to the database they are taken back to their view messages page(shows a list of related messages on page). However when I click submit to add a message it doesn’t pass the parameter too the url.

 public function add_admin($id=null){
    //allows user to add a new message to a dispute
    $this->set('title_for_layout', 'Dispute Information');
    $this->set('stylesheet_used', 'homestyle');
    $this->set('image_used', 'eBOXLogoHome.png');
    $this->layout='home_layout';
    //gets messages where Message.dispute_id=$id
    $dispute=$this->Message->field('dispute_id', array('dispute_id'=>$id));
    //sets the variables

    $this->set('dispute', $dispute);
    //$sets the variable $user to User.id
    $user=$this->Auth->User('id');
    //sets the variable
    $this->set('user',$user);
    //if the request posts to the database
    if($this->request->is('post')){
    //create an instance of message in the database
        $this->Message->create();
    //if the message saves
    if ($this->Message->save($this->request->data)) {
    //redirect the user to Messages/viewMessage_admin
        $this->redirect( array('controller' => 'Messages','action' => 'viewMessage_admin',$id));

    }
    }

    $this->set('id',$id);

    }

public function viewMessage_admin($id=null){
//allows users to view all messages related to a dispute
$this->set('title_for_layout', 'Dispute Information');
$this->set('stylesheet_used', 'homestyle');
$this->set('image_used', 'eBOXLogoHome.png');
$this->layout='home_layout';
$this->set('dispute_id',$id);
debug($id);
//find all messages where Message.dispute_id=$id
$Messages=$this->Message->find('all',array(
'conditions'=>array('dispute_id'=>$id)));
//find User details where user.id=message.user_id
$Username=$this->User->find('all', array(
'conditions'=>array(
'User.id'=>'Message.user_id')));
//get messages where message.dispute_id=$id
$dispute=$this->Message->field('dispute_id', array('dispute_id'=>$id));
//sets the variables
$this->set('dispute', $dispute);
$this->set('username', $Username);
$this->set('dispute_id',$id);
$this->set('message',$Messages);

}

here is the code for my form

<table id="data">
<tr>
<th>Please add your message below.</th></tr>
<tr><td>
<?php echo  $this->Form->create('Message', array('action'=>'add_admin')); ?>
<?php echo $this->Form->inpute('user_id', array('type'=>'hidden', 'value'=>$user)); ?>
<?php echo $this->Form->input('message',array('label'=>false)); ?>
</td></tr><tr><td>
<?php echo $this->Form->hidden( 'dispute_id', array( 'value' => $dispute ) ); ?>
<?php echo $this->Form->end('Submit'); ?></td></tr>
</table>
  • 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-11T22:34:20+00:00Added an answer on June 11, 2026 at 10:34 pm
    public function add_admin($id=null){
        //allows user to add a new message to a dispute
        $this->set('title_for_layout', 'Dispute Information');
        $this->set('stylesheet_used', 'homestyle');
        $this->set('image_used', 'eBOXLogoHome.png');
        $this->layout='home_layout';
        //gets messages where Message.dispute_id=$id
        $dispute=$this->Message->field('dispute_id', array('dispute_id'=>$id));
        //sets the variables
    
        $this->set('dispute', $dispute);
        //$sets the variable $user to User.id
        $user=$this->Auth->User('id');
        //sets the variable
        $this->set('user',$user);
        //if the request posts to the database
        if($this->request->is('post')){
        //create an instance of message in the database
            $this->Message->create();
        //if the message saves
        if ($this->Message->save($this->request->data)) {
    
        //redirect the user to Message.viewMessage_admin
        $id = $this->data['Message']['dispute_id'];
        $this->set('id',$id);
        $this->redirect(array('controller'=>'Messages','action'=>'viewMessage_admin',$id));
    
    
        }
        }
    
        $this->set('id',$id);
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently creating a page in PHP that will display a user and their
I am creating a section of my page that shows user addresses. The area
I am looking at creating a page that the user can move around as
I am creating a page that a user can click a link and it
I am creating a page that lets the user select an item from a
I am creating a page that has several user controls (similar to WebParts). Each
I'm creating a web page that user can send pm , receive it,add contact,response
I have a page that contains a dropdown list, and when a user selects
I'm creating a product page that requires the price to update when the quantity
I am creating a jQuery Mobile page that has two select menu's, one 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.