注册系统从错误的位置获取错误的信息

时间:2017-02-06 22:02:19

标签: php database login

我有这段代码。

PHP

  <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="Nickname" maxlength="50" value="<?php echo $name ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

                        <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="Nume" maxlength="50" value="<?php echo $Nume ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

                        <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="Prenume" maxlength="50" value="<?php echo $Prenume ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

                                    <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="NumePrenume" maxlength="50" value="<?php echo $NumePrenume ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="CNP" maxlength="50" value="<?php echo $CNP ?>" />
                </div>
                <span class="text-danger"><?php echo $CNPERROR; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="NumarTelefon" maxlength="50" value="<?php echo $NumarTelefon ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="ContBancar" maxlength="50" value="<?php echo $ContBancar ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="Poza" maxlength="50" value="<?php echo $Poza ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="Locatie" maxlength="50" value="<?php echo $Locatie ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="NumarPunctaj" maxlength="50" value="<?php echo $NumarPunctaj ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="Referal" maxlength="50" value="<?php echo $Referal ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="Varsta" maxlength="50" value="<?php echo $Varsta ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="IP" maxlength="50" value="<?php echo $IP ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
             <input type="text" name="name" class="form-control" placeholder="Cont" maxlength="50" value="<?php echo     $Cont ?>" />
                </div>
                <span class="text-danger"><?php echo $nameError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span></span>
             <input type="email" name="email" class="form-control" placeholder="Enter Your Email" maxlength="40" value="<?php echo $email ?>" />
                </div>
                <span class="text-danger"><?php echo $emailError; ?></span>
            </div>

            <div class="form-group">
             <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
             <input type="password" name="pass" class="form-control" placeholder="Enter Password" maxlength="15" />
                </div>
                <span class="text-danger"><?php echo $passError; ?></span>
            </div>

HTML

SELECT 
d.SeqNo,
d.SeqText,
h.UniqueID,
h.SeqID,
h.Room,
IF(h.Status = '1', SUM(h.Status), 0) AS TotalFails
FROM ".$SequenceNo_default." d
LEFT 
JOIN ".$Hist." h ON h.SeqID = d.SeqID 
WHERE  d.SeqActive = 1 AND DATE(CompStamp) BETWEEN DATE(   '".$_SESSION['StartDate']."') AND  DATE('".$_SESSION['EndDate']."')
GROUP BY h.Room
ORDER BY h.Status ASC

但是,当我注册新帐户时,会发生这种情况:

1)&#34;续&#34;部分被注册到昵称部分 2)Nume之后的部分不会更新到数据库中。部分显示为空白。

这是我遵循的教程:

1 个答案:

答案 0 :(得分:3)

您的所有输入都具有相同的名称:

 name="name"

每个输入都应该有一个唯一的名称,然后可以在$_POST数组中识别。

您还有其他问题,以下语法不正确:

if( isset($_SESSION['user'])!="" ){

对此的测试必须单独进行:

if( isset($_SESSION['user']) && $_SESSION['user'] != "" ){

从左到右阅读,“如果设置了会话用户且会话用户不为空,则执行以下操作”。