我试图将userTime变量放入php邮件的正文中 - 但我尝试的任何东西都只是返回空。
我尝试将其放入会话变量并使用$ _SESSION调用它,但不幸的是,它也失败了。
有什么建议吗?
<?php
session_start();
$userTable = $_SESSION['userTable'];
$userDay = $_SESSION['userDay'];
$userTime = $_POST['userOption'];
if (isset($_REQUEST['email'])) {
$admin_email = $_REQUEST['email'];
$email = "xxxxx@xxxxxx.xxx";
$subject = "Booking Confirmation";
$body = "Hi ".$_POST["name"].",\n\n";
$body .= "Your booking for ";
$body .= $userTable;
$body .= " on ";
$body .= $userDay;
$body .= " at ";
//none of these work
$body .= $_POST['userOption'];
$body .= $userTime;
$body .= $_REQUEST['usertime'];
// ^^^^^^^^^^^^^^^^^^^^^^^^^
$body .= " has been confirmed.\n\n";
$body .= "Your unique booking reference is ";
$body .= $_REQUEST['ranNum'];
$body .= ".\n\nPlease use this when arriving or in the event of a cancellation.\n\nThanks.";
mail("$admin_email", "$subject", $body, "From:" . $email);
?>
<script type="text/javascript">
alert("Mail sent!");
window.location.href = "index.php";
</script>
<?php
}
else {
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div align="center">
<form method="post">
Area entered:<br>
<input type="text" name="userarea" id="userarea" value="<?php echo $userTable; ?>" disabled><br>
Day entered:<br>
<input type="text" name="userday" id="userday" value="<?php echo $userDay; ?>" disabled><br>
Time entered:<br>
<input type="text" name="usertime" id="usertime" value="<?php echo $userTime; ?>" disabled><br>
Please enter your name:<br>
<input type="text" name="name" id="name"><br>
Please enter your email address:<br>
<input type="email" name="email" id="email"><br>
<!--the random number-->
<input type="hidden" name="ranNum" id="ranNum" /><br>
<button type="submit" value="Submit" class="homepageSubmit">Submit</button>
</form>
</div>
</body>
</html>
<?php
答案 0 :(得分:1)
在HTML表单中使用select c.comment_id,
c.comment_content,
u.user_id,
u.user_name,
p.post_id,
p.post_content
from comments c
join users u on u.user_id = c.user_id
join posts p on c.post_id = p.post_id;
表示它不会发送到服务器。也许尝试el:
或隐藏,只显示字段为文本。
您的表单中也没有disabled
字段。