以下是我的HTML代码......
<form action="http://mycloud.zymichost.com/registerPHP.php" method="post" id="register" data-ajax="false">
<label>Name: <br></label>
<input name="name" type="text" maxlength="50" ><br>
<label>Email: <br></label>
<input name="email" type="text" maxlength="50" ><br>
<label>Password: <br></label>
<input name="password" type="password" maxlength="50" ><br>
<input name="fsubmit" type="button" value="Submit"><br>
</form>
以下是我的php代码......
<title>registerPHP</title>
<?php
$name = $_POST ['name'];
$mail = $_POST['email'];
$pass = $_POST ['pass'];
//$un = 'abc';
//$pw = 'abc';
$mysql_hostname = "localhost";
$mysql_database = "mycloud_zymichost_register";
$mysql_user = "lorem-ipsum";
$mysql_password = "********";
$conn = mysql_connect($mysql_hostname,$mysql_user,$mysql_password);
mysql_select_db($mysql_database, $conn );
//$query = "SELECT * FROM Login WHERE username = '$un' AND password = '$pw'";
$query = "INSERT INTO Register (name,email,pass) VALUES ('$name','$email','$pass')";
$result = mysql_query($query) or die("Unable to insert user data because : " . mysql_error());
if ($result = mysql_query($query))
echo "Data is inserted";
?>
我把输入数据发送到我的数据库,这是mysql在线..我可以知道为什么吗?有时空值发送到数据库..我尝试从我的PHP输入..它可以.. BT使用html中的post方法调用php文件插入..值是nt进去..每次我刷新php页面。将null值插入我的数据库......
答案 0 :(得分:0)
看起来(从猜测)您尝试将表单数据提交到loginPHP,但保存数据的PHP是registerPHP?
答案 1 :(得分:0)
你的编队有loginphp.php。
你确定你发布的php代码名为loginphp.php吗?