我需要幫助將我的div存儲到php會話中。如何將html div存儲到php會話中?
<div name = "divResults">
(display results from mysql)
</div>
什麼,我需要做的恰恰是:
- 通過日期>搜索記錄。
- >結果將顯示在下一頁。
- >將會有一個按鈕發送電子郵件。
- >我的div中的結果將通過電子郵件發送給用戶。
我可以發送電子郵件,但無法發送結果。我已經使用這個
這是我的代碼結果頁面試圖通過日期搜索後:
<div name = "divResults">
<?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 "<table id=wTable>";
echo "<table id=hTable style=width:800px; border=1px;>
<tr style=background-color:black;color:yellow;font-size:18px;>
<th style=width:25px>ID</th>
<th style=width:200px>Username</th>
<th style=width:175px>Date</th>
<th style=width:225px>Serial Number</th>
<th style=width:200px>Location</th>
</tr>";
echo "</table>";
echo "<div id ='test' style=width:820px;height:200px;overflow:auto;>";
echo "<table id=dTable width=800px border=1px>";
while($row = mysql_fetch_assoc($getquery))
{
$r +=1;
echo "<tr style=color:black;background-color:lightgrey;font-size:13px;>";
echo "<td style=width:25px>" . $r . "</td>";
echo "<td style=width:200px>" . $row['Username'] . "</td>";
echo "<td style=width:175px >" . $row['Date'] . "</td>";
echo "<td style=width:225px>" . $row['SerialNumber'] . "</td>";
echo "<td style=width:200px>" . $row['Location'] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "</table>";
echo "</div>";
?>
</div>
<form method = "POST" action = "email-controller.php">
<font style ="color:orange"><b>From :</b></font>
<input type = "text" name = "sender" id = "sender" value = "<?php echo $_SESSION['email']; ?>" class = "sender">
<font style ="color:orange"><b>Send to :</b></font>
<input type = "text" name = "recipient" id = "recipient">
<input type = "submit" name = "sendEmail" id = "sendEmail" value = "Send">
</form>
這是我的電子郵件Controller.php這樣的代碼
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0;URL=autogeneratereport.php" />
</head>
<?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'];
?>
請分享您的代碼。你到目前爲止嘗試過什麼? –