Php 转到另一页时,$\u会话中的数据不会更新
我试图将表单中的值存储到会话中,它仅在更新同一页面时起作用。但是当我尝试在表单中放置onclick=“window.location='billing.php'”或action=“billing.php”时。 它不会更新会话中存储的值 这是我的密码Php 转到另一页时,$\u会话中的数据不会更新,php,session,Php,Session,我试图将表单中的值存储到会话中,它仅在更新同一页面时起作用。但是当我尝试在表单中放置onclick=“window.location='billing.php'”或action=“billing.php”时。 它不会更新会话中存储的值 这是我的密码 <form method="post" name="order"> <table width="900" border="0" align="center" cellpadding="2" cellspaci
<form method="post" name="order">
<table width="900" border="0" align="center" cellpadding="2" cellspacing="0" id='center'>
<tr>
<td><input type="radio" name="carrier" <?php if (isset($carrier) && $carrier=="LBC") echo "checked";?> value="LBC"></td>
<td><img src="../paymentoptions/LBC.jpg" alt="LBC" class="picture"/></td>
<td><p>The Shipping takes 1-2 days for NCR and 2-3 days for any provincial.<p>
<div id='price'> Additional ₱250 </div></td>
</tr>
<tr>
<td><input type="radio" name="carrier" <?php if (isset($carrier) && $carrier=="PickUp") echo "checked";?> value="PickUp"></td>
<td><img src="../paymentoptions/Pick-up.jpg" alt="Pick-Up" class="picture"/></td>
<td><p>Office hours: 10:00 am to 5:00 pm<p>
<div id='price'> Free!! </div></td>
</tr>
</table>
<br>
<br>
<center><h1>Payment Method</h1></center>
<table width="900" border="0" align="center" cellpadding="2" cellspacing="0" id='centerdown'>
<tr>
<td><input type="radio" name="payment" <?php if (isset($payment) && $payment=="BPI") echo "checked";?> value="BPI"></td>
<td><img src="../paymentoptions/BPI.jpg"></td>
<td><p>Pay by BPI bank deposit (we need confirmation of payment through email.)<p></td>
</tr>
<tr>
<td><input type="radio" name="payment" <?php if (isset($payment) && $payment=="PickUp") echo "checked";?> value="PickUp"></td>
<td><img src="../paymentoptions/Pick-up.jpg"></td>
<td><p>Pick up. You have 5 days reservation period. You pay for the merchandise upon pick-up<p></td>
</tr>
</table>
<table>
<tr><td><input type="button" value="View Shopping Cart" onclick="window.location='shoppingcart.php?'"></td><td><input type="submit" name="order" value="Place Order"><!--<input type="button" value="Confirm Order" onclick="window.location='quotation.php?'">--></td></tr>
</table>
</form>
<?php
if (isset($_POST['order'])){
$_SESSION['carrier'] = $_POST['carrier'];
$_SESSION['payment'] = $_POST['payment'];
}
?>
</div>
<?php echo $_SESSION['carrier']; ?>
<?php echo $_SESSION['payment']; ?>
value=“拾取”>
办公时间:上午10:00至下午5:00
自由的
付款方式
value=“拾取”>
接电话。您有5天的预订期。您在提货时付款
如何修复它,以便会话中存储的数据也将在下一页中传输?我的代码现在可以工作,但不会转到其他页面。当我转到另一页时,以前存储在同一页中的值也会显示相同的值,即使我已经更改了该值
多谢各位。希望您能帮助我。根据我们通过聊天室进行的对话,我将提交答案以结束问题 您的第一个文件已被删除
if (isset($_POST['order'])){
$_SESSION['carrier'] = $_POST['carrier'];
$_SESSION['payment'] = $_POST['payment'];
}
将其移动到第二个文件的顶部
session_start()
在所有使用会话的页面内?更新接收帖子页面上的会话变量?为什么不将onclick=“window.location='shoppingcart.php?”
放在表单操作中,如@Fred ii-是,每个页面都有会话启动()@我使用的pc shooter
,但它没有进入billing.php。它只是刷新页面并更新会话,但当我将类型更改为button时,它会转到billing页面,但不会更新会话。