title: How to send field value from one page to another using php session?
body: <p>As i am a beginner and i am stucked in a situation. Note: Email sending code present in thankyou.php</p>
  
  <p>My problem is i have to store the Date selected and pass to another page after completion of payment through paypal. I have tried php session but dont where i am lagging.</p>
  
  <p>After success full transaction i am getting all the details in $_POST from the paypal like txn_id, payer_email etc but i am not getting the date which i selected in form.</p>
  
  <p>Please help me to the right direction.</p>
  
  <p>I am working on paypal integration and i have 1 form in which two fields are present (index.php)</p>
  
  <ol>
  <li>Select date</li>
  <li>No. of tickets</li>
  </ol>
  
  <p>Code index.php : </p>
  
  <pre><code>    &lt;?php
  
  @session_start(); 
      $var_value = $_POST['eventdate'];
      $_SESSION['eventdate'] = $var_value;
      echo $_SESSION['eventdate'];
  ?&gt;
  
  &lt;form name="_xclick" action="https://www.sandbox.paypal.com/r" method="post"&gt;
                        &lt;table border="0" cellspacing="0" cellpadding="5" id="tbl_paypal_form"&gt;
                          &lt;tr&gt;
                            &lt;td colspan="2"&gt;&lt;div id="ticket_amount"&gt;£10 per person&lt;/div&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                            &lt;td&gt;Select Event Date &lt;span class="mandatory"&gt;*&lt;/span&gt;&lt;/td&gt;
                            &lt;td&gt;&lt;select name="eventdate" id="eventdate" class="form_field"&gt;
                                &lt;option value=""&gt;Select Date&lt;/option&gt;
                                &lt;option value="Sat 14 July 2012"&gt;Sat 14 July 2012&lt;/option&gt;
                                &lt;option value="Sun 15 July 2012"&gt;Sun 15 July 2012&lt;/option&gt;
                                &lt;option value="Mon 16 July 2012"&gt;Mon 16 July 2012&lt;/option&gt;
                              &lt;/select&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                            &lt;td&gt;No. of Tickets &lt;span class="mandatory"&gt;*&lt;/span&gt;&lt;/td&gt;
                            &lt;td&gt;&lt;input type="text" name="quantity" id="quantity" class="form_field"&gt;
                            &lt;span style="color:#bbb; font-size:11px; padding-top:5px;"&gt;For ex: 4&lt;/span&gt;
                            &lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                            &lt;td colspan="2"&gt;&lt;?php
                                  if(!empty($errorMessage)) 
                                  {
                                      echo("&lt;div id='validation_error'&gt;");
                                      echo("&lt;p class='error_message'&gt;There was an error with your form:&lt;/p&gt;\n");
                                      echo("&lt;ul class='error_message'&gt;" . $errorMessage . "&lt;/ul&gt;\n");
                                      echo("&lt;/div&gt;");
                                  }
                              ?&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                            &lt;td&gt;&lt;img src="images/paypal.gif" /&gt;&lt;/td&gt;
                            &lt;td&gt;&lt;input type="image" src="images/btn_paypal.gif" border="0" name="formsubmit" value="Submit" onclick="return ValidateForm();" alt="Make payments with PayPal - it's fast, free and secure!"&gt;                              
                            &lt;/td&gt;
                          &lt;/tr&gt;
                        &lt;/table&gt;
                        &lt;input type="hidden" name="cmd" value="_xclick"&gt;
                        &lt;input type="hidden" name="business" value="gala@iskconcoventry.com"&gt;
                        &lt;input type="hidden" name="currency_code" value="EUR"&gt;
                        &lt;input type="hidden" name="item_name" value="Gala Charity Show Tickets"&gt;
                        &lt;input type="hidden" name="amount" value="10"&gt;
                        &lt;input type="hidden" name="return" value="http://www.vyx.com/gala/thankyou.php"&gt;
                        &lt;input type="hidden" name="notify_url" value="http://www.xyx.com/gala/thankyou.php"&gt;
                        &lt;input type="hidden" name="cbt" value="Return to The Store"&gt;
                        &lt;!--&lt;input type="hidden" name="eventdate" value="&lt;?php echo $_POST['eventdate'];?&gt;"&gt;--&gt;
                      &lt;/form&gt;
  </code></pre>
  
  <p>Code: thankyou.php</p>
  
  <pre><code>&lt;?php
  
  session_start();
  $ticketdate = $_SESSION['eventdate'];
  //echo $_SESSION['eventdate'];
  echo $ticketdate;
  ?&gt;
  
  &lt;pre style="background:#fff;"&gt;
  &lt;?php print_r($_POST);?&gt;
  &lt;/pre&gt;
  
  &lt;?php
  
  
  if($_POST['txn_id'] != "") 
  {
      $mail_subject='Ticket Booked for Gala Charity event';
      $mail_body.= 'Hello Dear, &lt;br&gt;&lt;br&gt;';
      $mail_body.= 'Below are the ticket booking details for Gala Charity event. &lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Booking Date : &lt;/b&gt;'. $ticketdate .'&lt;br&gt;&lt;br&gt;';
      //$mail_body.= '&lt;b&gt;Booking Date : &lt;/b&gt;'.trim($_POST['eventdate']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Number of tickets buyed : &lt;/b&gt;'.trim($_POST['quantity']).'&lt;br&gt;&lt;br&gt;';
  
      $mail_body.= '&lt;b&gt;Transaction ID : &lt;/b&gt;'.trim($_POST['txn_id']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;First Name : &lt;/b&gt;'.trim($_POST['first_name']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Last Name : &lt;/b&gt;'.trim($_POST['last_name']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Payers Email  : &lt;/b&gt;'.trim($_POST['payer_email']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Payment Date : &lt;/b&gt;'.trim($_POST['payment_date']).'&lt;br&gt;&lt;br&gt;';
  
      $mail_body.= '&lt;b&gt;Address Name : &lt;/b&gt;'.trim($_POST['address_name']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Street : &lt;/b&gt;'.trim($_POST['address_street']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Zip : &lt;/b&gt;'.trim($_POST['address_zip']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;State : &lt;/b&gt;'.trim($_POST['address_state']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Country Code : &lt;/b&gt;'.trim($_POST['address_country_code']).'&lt;br&gt;&lt;br&gt;';
  
  
      $mail_body.= '&lt;b&gt;Item Name : &lt;/b&gt;'.trim($_POST['item_name']).'&lt;br&gt;&lt;br&gt;';
      $mail_body.= '&lt;b&gt;Total Amount Paid : &lt;/b&gt;'.trim($_POST['mc_currency']).'&amp;nbsp;'.trim($_POST['mc_gross']).'&lt;br&gt;&lt;br&gt;';
  
      $mail_from=$_POST['payer_email'];
      $mail_to = "myname@example.com";
  
      //$mail_reply_to = $mail_from;
      $mail_headers = "Content-Type: text/html; charset=iso-8859-1\r\nFrom: $mail_from\r\nReply-to: $mail_reply_to\r\n";
      @mail($mail_to, $mail_subject, $mail_body, $mail_headers);
  
  }
  ?&gt;
  </code></pre>