title: How to store a html div into a php session?
body: <p>I need help in storing my div into a php session. </p>
  
  <pre><code>&lt;div name = "divResults"&gt;
  (display results from mysql)
  &lt;/div&gt;
  </code></pre>
  
  <p>What i need to do exactly is:</p>
  
  <p>->Search records through dates.<br>
  ->Results will be shown on next page.<br>
  ->There will be a button to send an email.<br>
  ->Results in my div will be send through an email to a user.<br></p>
  
  <p>I'm able to send an email but I couldn't send the results. I've tried using this </p>
  
  <p>This are my codes for results page after searching through dates :</p>
  
  <pre><code>&lt;div name = "divResults"&gt;
  &lt;?php
  
  $getquery = mysql_query("SELECT * FROM Records WHERE Date = '".$sdbStart."' AND Records.SerialNumber NOT IN (SELECT SerialNumber FROM ImportData WHERE Date ='".$adbStart."') ORDER BY Date DESC LIMIT $start, $per_page");
  
                              $_SESSION['getquery'] = $getquery;
  echo "&lt;table id=wTable&gt;";
                              echo "&lt;table id=hTable style=width:800px; border=1px;&gt;
                                      &lt;tr style=background-color:black;color:yellow;font-size:18px;&gt;
                                      &lt;th style=width:25px&gt;ID&lt;/th&gt;
                                      &lt;th style=width:200px&gt;Username&lt;/th&gt;
                                      &lt;th style=width:175px&gt;Date&lt;/th&gt;
                                      &lt;th style=width:225px&gt;Serial Number&lt;/th&gt;
                                      &lt;th style=width:200px&gt;Location&lt;/th&gt;
                                      &lt;/tr&gt;";
  
                              echo "&lt;/table&gt;";
                              echo "&lt;div id ='test' style=width:820px;height:200px;overflow:auto;&gt;";
                              echo "&lt;table id=dTable width=800px border=1px&gt;";  
  
                              while($row = mysql_fetch_assoc($getquery))
                              {
                              $r +=1;
                              echo "&lt;tr style=color:black;background-color:lightgrey;font-size:13px;&gt;";
                              echo "&lt;td style=width:25px&gt;" . $r . "&lt;/td&gt;";
                              echo "&lt;td style=width:200px&gt;" . $row['Username'] . "&lt;/td&gt;";
                              echo "&lt;td style=width:175px &gt;" . $row['Date'] . "&lt;/td&gt;";
                              echo "&lt;td style=width:225px&gt;" . $row['SerialNumber'] . "&lt;/td&gt;";
                              echo "&lt;td style=width:200px&gt;" . $row['Location'] . "&lt;/td&gt;";
                              echo "&lt;/tr&gt;";
                              }
                              echo "&lt;/table&gt;";  
                              echo "&lt;/table&gt;";
                              echo "&lt;/div&gt;";
  ?&gt;
  &lt;/div&gt;
  
  
  
  &lt;form method = "POST" action = "email-controller.php"&gt;
  
          &lt;font style ="color:orange"&gt;&lt;b&gt;From :&lt;/b&gt;&lt;/font&gt;
          &lt;input type = "text" name = "sender" id = "sender" value = "&lt;?php echo $_SESSION['email']; ?&gt;" class = "sender"&gt;
  
          &lt;font style ="color:orange"&gt;&lt;b&gt;Send to :&lt;/b&gt;&lt;/font&gt;
          &lt;input type = "text" name = "recipient" id = "recipient"&gt;
  
          &lt;input type = "submit" name = "sendEmail" id = "sendEmail" value = "Send"&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>This are my email-controller.php codes</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="refresh" content="0;URL=autogeneratereport.php" /&gt;
  &lt;/head&gt;
  
  &lt;?php
  $conn = mysql_connect('localhost', 'un', 'pw');
  
  mysql_select_db('db');
  
  $sender = $_POST['sender'];
  $recipient = $_POST['recipient'];
  $_SESSION['divData'] = $_POST['divData'];
  
  session_start();
  $_SESSION['sender'] = $sender;
  $_SESSION['recipient'] = $recipient;
  
  $senderQuery = mysql_query("SELECT * FROM Users WHERE Email = '".$sender."'");
  $senderData = mysql_fetch_array($senderQuery);
  $_SESSION['senderEmail'] = $senderData['Email'];
  $_SESSION['senderFN'] = $senderData['FullName'];
  
  
  $recipientQuery = mysql_query("SELECT * FROM Users Where Email = '".$recipient."'");
  $recipientData = mysql_fetch_array($recipientQuery);
  $_SESSION['recipientEmail'] = $recipientData['Email'];
  $_SESSION['recipientFN'] = $recipientData['FullName'];
  
  
  $getquery = $_SESSION['getquery'];
  
  
  
  ?&gt;
  </code></pre>