2012-03-01 111 views
0

下面是我的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頁面..空值將被插入到我的數據庫...

+2

http://bobby-tables.com/ – Quentin 2012-03-01 15:15:59

+1

我會刪除密碼! – 2012-03-01 15:16:00

+0

爲什麼不告訴我你的主人呢? :P – 2012-03-01 15:42:57

回答

0

看起來像(從猜測)你試圖提交表單數據到loginPHP但保存數據的PHP是registerPHP? !

+0

是啊,我想把它改成registerPHP.php ..但它仍然是一樣的。 – henrykwl 2012-03-02 11:40:47

0

你的形成有loginphp.php。

您確定您發佈的php代碼的名稱是loginphp.php嗎?

+0

是的,我已經改變它registerPHP.php .. BT它仍然是一樣的.. – henrykwl 2012-03-02 11:27:39