2 回答
TA贡献1906条经验 获得超10个赞
解决方案在这里!
表单.php
<html>
<head>
<title>Log-in</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<h1>Log-in</h1>
</div>
<form action="data_received.php" method="post">
<div data-for="date">
<label>Date</label>
<input type="text" name="date">
</div>
<div data-for="time">
<label>Time</label>
<input type="text" name="time">
</div>
<input type="submit" name="register_btn" class="Register"></td>
</body>
</html>
data_received.php
<html>
<head>
<title>Log-in</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(window).on('load', function() {
window.open("pdf.php", "pdf", "height=400,width=400");
})
</script>
</head>
<body>
<div class="header">
<h1>Log-in</h1>
</div>
<form >
<?php
session_start();
$date = $_POST['date'];
$time = $_POST['time'];
$_SESSION["date"] = $_POST['date'];
$_SESSION["time"] = $_POST['time'];
echo $date;
echo '<br/>';
echo $time;
?>
<br/>
<input type="Button" value="Back" onclick="windoe.location.href ='form.php';">
<input type="Button" value="Print to pdf " onclick="window.location.href = 'pdf.php';">
</form>
</body>
</html>
pdf文件
<html>
<head>
<title>Log-in</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<h1>PDF</h1>
</div>
<form method="post" >
<?php
session_start();
?>
<table>
<tr>
<td>Date:</td>
<td><input type="text" value="<?PHP if(isset($_SESSION['date'])){echo $_SESSION['date'];}?>"></td>
</tr>
<tr>
<td>Time:</td>
<td><input type="text" value="<?PHP if(isset($_SESSION['time'])){echo $_SESSION['time'];}?>"></td>
</tr>
<tr>
<td></td>
<td><input type="Button" value="Close" onclick="self.close();"> </td>
</tr>
</table>
</form>
</body>
</html>
- 2 回答
- 0 关注
- 107 浏览
添加回答
举报