2014-04-26 124 views
0

我在html中注册了一个表单,但它没有提交任何数据到php文件。奇怪的是,对我来说,在同一页面上看起来完全一样的表单确实有效,而且这个表单一直起作用。我可能在某个地方意外地改变了一些事情。表单不提交数据

形式:

<form action="http://test.com/register.php" method="POST" enctype="multipart/form-data"> 
    <fieldset> 
    <div align="left"> 
    <label>Username</label> 
    <input type="text" required class="span11" name="fUsername" id="Username" placeholder="username"> 

<label>Password</label> 
    <input type="password" required class="span11" name="fPassword" id="Password" placeholder="password"> 

    <label>Retype password</label> 
    <input type="password" required class="span11" name="fRetypepassword" id="Retypepassword" placeholder="retype password"> 

    <label>Phone number</label> 
    <input type="text" required class="span11" name="fPhone" id="Phone" placeholder="+... international format"> 

    <label>E-Mail</label> 
    <input type="email" required class="span11" name="fEmail" id="Email" placeholder="e-mail"> 
<br><br> 
    <button type="submit" class="btn btn-info">Register</button> 
    </div> 
    </fieldset> 
</form> 

的PHP:

$username = htmlspecialchars($_GET['fUsername']); 
$password=htmlspecialchars($_GET['fPassword']); 
$passwordmatch=htmlspecialchars($_GET['fRetypepassword']); 
$email=htmlspecialchars($_GET['fEmail']); 
$phone=htmlspecialchars($_GET['fPhone']); 

echo $username; 

回答

5

的形式发送带有POST方法的数据,但是你想从$ _GET阅读。

尝试: -

$username = htmlspecialchars($_POST['fUsername']); 
$password = htmlspecialchars($_POST['fPassword']); 
$passwordmatch = htmlspecialchars($_POST['fRetypepassword']); 
$email = htmlspecialchars($_POST['fEmail']); 
$phone = htmlspecialchars($_POST['fPhone']); 
+0

:O,I监督,我知道我是在一个简单的办法盯着!谢谢!!当他们允许我时,我会接受你的答案。 – Diego

+0

太好了 - 谢谢! :) –