所以这就是问题,我不确定我的数据库是否成功连接,如果是,那么我的输入查询不起作用。这就是我所拥有的。我确定我的错误是相当明显的,我可能会自己踢,但请帮忙。
HTML:
<form action="adduser.php" method="post">
<label>Create Username</label><br>
<input type="text" name="username" placeholder="Username" /><br>
<label>Create Password</label><br>
<input type="password" name="password" placeholder="Password" /><br>
<label>Confirm Password</label><br>
<input type="password" placeholder="Password" /><br>
<label>Select Gender</label><br>
<input type="radio" name="gender" value="Male">Male</button>
<input type="radio" name="gender" value="Female">Female</button><br>
<label>Click submit to continue</label><br>
<button class="btn btn-primary" name="submit" type="submit">Submit</button>
</form>
connect.php:
<?php
$username = "********";
$password = "***********";
$db = "localhost";
$dbconn = mysql_connect($db, $username, $password);
if (!$dbconn){
die ("Connection failure!");
}
return "Connection Successful.";
mysql_select_db("who_do_it_db", $dbconn);
?>
adduser.php:
<?php
include 'connect.php';
$uName = $_POST['username'];
$pWord = $_POST['password'];
$gender = $_POST['gender'];
$query = 'INSERT INTO users(Username, Password, Gender) VALUES ("$uName","$pWord","$gender");';
$query = mysql_query($query);
答案 0 :(得分:0)
您在附带的文件中有return
。因此,脚本在那里完成,并且在include
adduser.php
之后永远不会到达任何命令