我有2個php腳本,它從html頁面上的表單中獲取值並將它們返回給用戶,以便他可以檢查它們是否正確我然後要允許他然後通過按提交按鈕確認,這些值將被寫入一個txt文件。 這裏是我的代碼,我到目前爲止,腳本返回的值被寫入該文件,但沒有什麼文件中>將post值從一個php傳遞到另一個php頁面
代碼: 拳頭PHP:
$surname = $_POST['surname'];
$lastname = $_POST['lastname'];
$mail = $_POST['mail'];
<div id="oneConatiner">
<h1>Please confirm the details of your order:</h1>
<div align="left" id='php'>
<form name="info" method="post" action="confirmation.php">
<p>Your surname is: <?php echo $surname . "<p>"; ?>
<p>Your lastname is: <?php echo $lastname . "</p></div>"; ?>
<p>Your email is: <?php echo $mail . "<p>"; ?>
<p><input type="submit" name="Submit" value="Confirm" /></p>
</form>
</div>
第二個PHP :
<?php
$surname = $_POST['surname'];
$lastname = $_POST['lastname'];
$mail = $_POST['mail'];
$page = ceil($quantity/10);
$data = "$surname,$lastname,$mail\r\n";
$fh = fopen("user.txt", "a");
fwrite($fh, $data);
fclose($fh);
if (fwrite == FALSE){
echo "fail";
} else {
echo "successful";
}
?>