这种形式有什么问题?

时间:2014-08-27 14:30:27

标签: php mysql css html5

我编码"忘记密码"但它不起作用:(

<form id="contact-form" action="recoveryLogin.php" method="post">


                <!-- Subscribe Form Header-->
                <header>
                <h3>Recovery <br/>
                <i class="icon-envelope-alt icon-2x"></i>
                </h3>
                </header>
                <!-- End Subscribe Form Header-->

                <!--Text-->
                <p class="headerForm">Email! </p>

                <!--End Text-->

                <!-- Personal Infomation -->
                <label> <input type="email" placeholder="Email" id="email" required > </label>
                <!-- End Personal Infomation -->

                <!-- Submit Button -->
                <button name="submit" type="submit" id="contact-submit"><i class="icon-ok"></i> SEND</button>
                <!-- End Submit Button -->
                <input type="hidden" name="recup" id="recup" value="form_recup" />
                </form>

我的功能php

if(isset($_POST["email"])){
    $email = $_POST['email'];
    $query = "SELECT * 
            FROM usuario_altherma 
            WHERE email = '".$email."'";
    $result = mysql_query($query,$dbhandle);
    $numrows = mysql_num_rows($result);

    if($result == 1){
        $row = mysql_fetch_array($numrows);
        $password = $row['contrasenia_elegida'];
        $email = $row['email'];
        echo $email;

} }

任何想法,但它不起作用?密码将通过电子邮件发送,但这没有问题。参数&#34; email&#34;没有进入查询:S

1 个答案:

答案 0 :(得分:1)

据推测,您需要为电子邮件输入添加name - 属性,如下所示:

<input type="email" placeholder="Email" id="email" required name="email">

仅设置id(仅用于客户端)和type(用于输入字段的浏览器解释)... name - 属性是不够的是发送回服务器时识别字段值的内容。

这可以解决问题吗?