在變量存儲TEXT_INPUT的值我有2頁:誤差在PHP
- send.php
- confirm.php
在send.php我有一個輸入text_box輸入一個數字(例如:12345)由終端用戶(這個號碼是數據庫中的私鑰)。接下來我想將輸入的號碼(12345)存儲在會話中。在第2頁我想從會話中讀取該數字(12345),並用它從數據庫中選擇行。但是出現錯誤:
注意:未定義索引:nid在第4行的C:\ xampp \ htdocssend.php中
<?php
include "db.php";
session_start();
$nid=$_POST["nid"];
$_SESSION['user_id']=$nid;
//$_SESSION['nid']=True;
if(isset($_POST['nid'])){
header("Location: confirm2.php");
exit;
}
<form action="send.php" method="post">
<div class="top-row">
<div class="field-wrap">
<label>
your id<span class="req">*</span>
</label>
<input type="text" required autocomplete="off" name="nid" />
</div>
<button type="submit" class="button button-block"/>submit</button>
</div>
</form>
什麼是send.php代碼?對不起,我看到這是發送。但是這個帖子? – Andreas
開始使用print_r($ _ POST)並檢查是否設置了「nid」@Andreas我添加了其他很多send.php代碼 –