如何从home.php获取值并使用SESSION将其传递给1home.php。我希望1home.php获取home.php的值,每次我改变它的值。
session_start();
<form method="post" action="1home.php">
<label id="checkinD">
<h3>Day</h3>
<Input id="chiD" name="chiD" type="number" min="<?php echo $_SESSION["day_today"]; ?>" max="<?php echo $_SESSION["day_count"]; ?>" required />
</label>
</form>
session_start();
<form method="post" action="2home.php" onsubmit="return validate()">
<label id="checkinD">
<h3>Day</h3>
<Input id="chiD" name="chiD" type="text" value = "
<?php echo $chiD; ?>" readonly />
</label>
答案 0 :(得分:1)
在第一页中你有值
session_start();
$_SESSION["yourValue1"] = $yourValue1;
$_SESSION["yourValue2"] = $yourValue2;
在第二页中你想要得到它们
session_start();
echo "your yourValue1 value is " . $_SESSION["yourValue1"] . ".<br>";
echo "your yourValue2 value is " . $_SESSION["yourValue2"] . ".";