我相信我已经创建了某种非常简单的登录表单。如何在另一个页面上显示姓名和电子邮件?即使我正确地创建了会话也是如此。
<?php
session_start();
include('./includes/mysql_connect.php');
$email = ($_POST['email']);;
$password = ($_POST['password']);
$match = "SELECT name FROM users WHERE email='$email' AND password='$password'";
$qry = mysql_query($match);
$num_rows = mysql_num_rows($qry);
if($num_rows <=0 ){
echo "Sorry there is no email";
exit;
} else {
$_SESSION['user']=$_POST['email'];
header("location:logged.php");
}
?>
Create table
陈述:
CREATE TABLE IF NOT EXISTS `users` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`email` varchar(40) NOT NULL,
`password` varchar(40) NOT NULL,
`name` varchar(30) NOT NULL,
PRIMARY KEY (`id`);