dtcu5885 2014-02-28 06:57
浏览 27

登记表不回应

I am very new to PHP and I cannot get this if statement to echo when you click submit. My editor isn't showing any errors with the code and it seems to work fine, except for it not echoing the errors.

<html>
<LINK rel='stylesheet' href='style.css' type='text/css'>

<?php
$submit = $_POST['submit'];
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$repeatpassword = md5(strip_tags($_POST['repeatpassword']));

$date = date('Y-m-d');
echo $date;
if ($sumbit)
{
    if ($username&&$password&&$repeatpassword)
    {
        $password = md5($password);
        $repeatpassword = md5($repeatpassword);

        if ($password==$repeatpassword) 
        {
            if(strlen($username)>25)
            {
                echo 'Length of username must be less than 25 charcters';
            }
            else 
            {
                if (strlen($password)>25||strlen($password)<6)
                {
                    echo 'Your password must be 6 to 25 characters long';
                }
                else 
                {
                    echo 'Success!';
                }
            }
        }
        else 
        {
            echo 'Passwords do not match';
        }

    }
    else
        echo 'Fill in all the fields';
}
?>

<form action='register.php' method='POST'>
    <table>
        <tr>
            <td>Username</td><br />
        </tr>  
        <tr>  
            <td><input type='text' name='username'></td><br />
        </tr> 
        <tr>
            <td>Password</td><br />
        </tr>
        <tr>    
            <td><input type='password' name='password'></td><br />
        </tr>    
        <tr>    
            <td>Repeat Password</td><br />
        </tr>
        <tr>
            <td><input type='password' name='repeatpassword'></td><br />
        </tr>
    </table>
        <p>
            <input type='submit' name='submit' value='Register'>
</form>

</html>
  • 写回答

6条回答 默认 最新

  • douzi115522 2014-02-28 07:00
    关注

    try this

    if(isset($_POST['submit']))
    {
      if (isset($_POST['username'], $_POST['password'], $_POST['repeatpassword']))
      {
        $username = strip_tags($_POST['username']);
    
        $password = strip_tags($_POST['password']);
        $repeatpassword = md5(strip_tags($_POST['repeatpassword']));
    

    instead of

    if ($sumbit)
    {
       if ($username&&$password&&$repeatpassword)
       {
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据