php mysql 未定义索引

标签 php mysql indexing undefined

我有三个 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/

相关文章:

php - 如何避免 substr() 破坏 html 标签?

php - MongoDB $lookup with _id 作为 PHP 中的 foreignField

php - 将查询结果放入数组然后内爆?

mysql - 如何始终将值 1 分配给创建的 LAST "row_id"

ruby-on-rails - ElasticSearch:如何正确映射关联以便它们也可搜索?

python - 当数据帧上存在混合数据类型时,为什么我无法使用 loc 赋值?即一些列有字符串,其他列有数字

python - 如何在 tkinter python 中为变量指定不同的名称

php - Magento 报告安装错误 : "Database server does not support the InnoDB storage engine"

javascript - 客户端未收到页面发送的电子邮件

mysql - 获取所有行在列中显示相同的值