-1
我遇到了一些PHP代碼的麻煩。我能夠讓代碼在我的測試網站上工作。我現在正在嘗試使用彈出式註冊菜單註冊用戶。當我輸入信息並單擊我的註冊按鈕時,不會將任何內容發送到我的數據庫表中。
繼承人我的代碼。信息不會進入我的表
<!doctype html>
<html lang="en">
<head>
<title>untitled.com</title>
<meta name="description" content="">
<link rel="stylesheet" type="text/css" href="frontPage.css">
<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/general.js" type="text/javascript">
</script>
</head>
<body>
<h1> untitled </h1>
<h2> description of website</h2>
<div id="wrapper">
<nav id="nav">
<ul id="navigation">
<a class="button" href="" >Login</a>
<div class="popup">
<a href="#" class="close">CLOSE</a>
<form>
<P><span class="title">Username</span> <input name="" type="text" /></P>
<P><span class="title">Password</span> <input name="" type="password" /></P>
<P><input name="" type="button" value="Login" /></P>
</form>
</div>
</ul>
</nav>
<?php
require('db.php');
if (isset($_POST['username'])){
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];;
$query = "INSERT into `users` (username, password, email, city, state, zip, phone) VALUES ('$username', '".md5($password)."', '$email', '$city', '$state', '$zip', '$phone')";
$result = mysql_query($query);
if($result){
echo "<div class='form'><h3>You are registered successfully.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
}
}else{
?>
<a class="Regbutton" href="#" >Register</a>
<div class="Regpopup">
<a href="#" class="close">CLOSE</a>
<form>
<P><span class="title">Username</span> <input name="username" type="text" /></P>
<P><span class="title">Password</span> <input name="password" type="password" /></P>
<P><span class="title">Email</span> <input name="email" type="email" /></P>
<P><span class="title">City</span> <input name="city" type="text" /></P>
<P><span class="title">State</span> <input name="state" type="text" maxlength="2" /></P>
<P><span class="title">zip</span> <input name="zip" type="text" maxlength="5" /></P>
<P><span class="title">phone</span> <input name="phone" type="text" maxlength="15"/></P>
<P><input type="submit" name="submit" value="Register" /></P>
</form>
</div>
<?php } ?>
</body>
</html>
你忘記填寫<輸入名稱= 「???」 ......我的意思是<輸入名稱= 「用戶名」 和... <輸入名稱= 「密碼」 ...... –
''
謝謝!我忽略它,它現在起作用。我真的不知道SQL注入是什麼。 – Cory