我有三个 php 页面,第一个页面是在字段中输入用户详细信息,第二个页面是在数据库中插入用户详细信息,第三个页面是显示已发送到数据库的用户详细信息,
一切正常,除了在第三页中未出现用户详细信息并且我收到此错误消息:
注意: undefined variable :用户 注意: undefined variable :电子邮件 注意: undefined variable :pass
这是我的代码:
first_page.php
<form action="second_page.php" method="post" >
User Name:
<input type="text" name="username" >
User Email
<input type="text" name="useremail" >
Password:
<input type="text" name="password" >
<input type="submit" name="submit" >
</form>
<小时/>
第二页.php
if (isset($_POST['submit']))
{
$user= $_POST['username'];
$email = $_POST['useremail'];
$pass= $_POST['password'];
mysql_query("INSERT INTO table (username, useremail, password) VALUES ('$user','$emai','$pass');
header("location: third_page.php");
exit;
<小时/>
third_page.php
$user= $_POST['username'];
$email = $_POST['useremail'];
$pass= $_POST['password'];
echo ' the user name: '.$user;
echo ' the user email:.'$email;
echo 'the user password:.'$pass;
最佳答案
$user_id = mysql_insert_id();
header("location: third_page.php?id=$user_id");
anf ftech data from datbase
关于php mysql 未定义索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18124180/