this action renders the form sell.php. I want to know how can I pass data received by this action to another action in the same controller
public function actionSell()
{
$model=new LandlordRent;
$countries = Allcountries::model()->findAll(array('order' => 'country ASC'));
if(isset($_POST['LandlordRent']))
{
$model->attributes=$_POST['LandlordRent'];
}
$countries = Allcountries::model()->findAll(array('order' => 'country ASC'));
$user = Userregistration::model()->findAll();
$this->render('sell',array('model'=>$model, 'countries'=>$countries, 'user'=>$user));
}
this is the start of form in sell.php view file
<?php $country=CHtml::listData($countries,'country','country');
$form=$this->beginWidget('CActiveForm', array(
'id'=>'landlordrent-form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>true,
'htmlOptions'=>array('enctype'=>'multipart/form-data'),
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
This is the action which renders thanks view on form submission and sends email. How can I pass $_POST data from the actionSell action to this action ?
public function actionThanks()
{
$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Request a call back : Emailer</title>
</head>
<body style="background:#BA954E; margin:0 auto;padding:0px;font-family:Arial, Helvetica, sans-serif;">
<div style="width:100%;text-align:center;font-family:Arial, Helvetica, sans-serif;">
<div style="width:640px;text-align:left;margin:0 auto; background:#3C4976; border:1px solid #ffffff; padding:25px 15px;margin-top:50px;">
<div style="margin-bottom:20px;"><img src="http://www.elysianrealestate.com/images/logo.png" alt="" /></div>
<div style="color:#363435; font-size:16px; font-weight:bold; background:#BA954E;padding:5px; border:1px solid #ffffff; color:#fff">Home Page Enquiry</div>
<div style="color:#363435; padding:0px; margin:20px 0px 0px 0px; font-size:12px;">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%;">
<tr>
<td style="background-color:#BA954E;">
<table cellpadding="2" cellspacing="2" style="width:100%; border:2px solid #3C4976; background-color:#BA954E; color:White;">
<tr>
<td style="background-color:#3C4976; padding:3px 10px; width:40%;">First Name</td>
<td style="background-color:#3C4976; padding:3px 10px; width:60%;">'. $_POST['txtYourName'].'</td>
</tr>
<tr>
<td style="background-color:#3C4976; padding:3px 10px; width:40%;">Last Name</td>
<td style="background-color:#3C4976; padding:3px 10px; width:60%;">'.$_POST['txtYourName'].'</td>
</tr>
<tr>
<td style="background-color:#3C4976; padding:3px 10px;">Email Address</td>
<td style="background-color:#3C4976; padding:3px 10px;">'.$_POST['txtEmail'].'</td>
</tr>
<tr>
<td style="background-color:#3C4976; padding:3px 10px;">Country</td>
<td style="background-color:#3C4976; padding:3px 10px;">'.$_POST['cmbCountry'].'</td>
</tr>
<tr>
<td style="background-color:#3C4976; padding:3px 10px;">Country Code</td>
<td style="background-color:#3C4976; padding:3px 10px;">'.$_POST['txtCountryCode'].'</td>
</tr>
<tr>
<td style="background-color:#3C4976; padding:3px 10px; width:40%;">Phone No.</td>
<td style="background-color:#3C4976; padding:3px 10px; width:60%;">'.$_POST['txtContactNumber'].'</td>
</tr>
<tr>
<td style="background-color:#3C4976; padding:3px 10px; width:40%;">Interested In</td>
<td style="background-color:#3C4976; padding:3px 10px; width:60%;">'.$_POST['typeOfService'].'</td>
</tr>
<tr>
<td style="background-color:#3C4976; padding:3px 10px; width:40%;">Area</td>
<td style="background-color:#3C4976; padding:3px 10px; width:60%;">'.$_POST['cmbDistricts'].'</td>
</tr>
<!--<tr>
<td style="background-color:#3C4976; padding:3px 10px; width:40%;">District</td>
<td style="background-color:#3C4976; padding:3px 10px; width:60%;">$ddlDistricts$</td>
</tr>-->
<tr>
<td style="background-color:#3C4976; padding:3px 10px; width:40%;">Comments</td>
<td style="background-color:#3C4976; padding:3px 10px; width:60%;">'.$_POST['txtEnquiry'].'</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
</body>';
$headers="From: abc@abc.com\r\nContent-type: text/html\r\nReply-To: abc@abc.com";
mail($_POST['txtEmail'],"Home Page Enquiry",$body,$headers);
$this->render('thanks');
}