下面是我的html代碼網上MySQL的連接我的HTML使用PHP
<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";
?>
我CNT輸入數據發送到我的數據庫這是MySQL在線..我可以知道爲什麼嗎?有時空值是發送到數據庫..我試圖從我的PHP輸入..它可以..使用HTML中的post方法來調用PHP文件插入..價值是nt進去..每次我刷新PHP頁面..空值將被插入到我的數據庫...
http://bobby-tables.com/ – Quentin 2012-03-01 15:15:59
我會刪除密碼! – 2012-03-01 15:16:00
爲什麼不告訴我你的主人呢? :P – 2012-03-01 15:42:57