我的插页中我做错了什么

我的插页中我做错了什么

本文介绍了我的插页中我做错了什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将表单输入添加到我的xampp localhost myphpadmin数据库,但无论我如何更改它,它都不想工作请帮助我。

我想要一个更短的表格但老师希望将所有这些信息分成一个表格和一个数据库-_-

I am trying to add the form input to my xampp localhost myphpadmin database but it no matter how I change it, it doesn't want to work HELP me please.
I wanted a shorter form but the teacher wants all this information into one form and one database -_-

<?php
$title="STUDENT REGISTER";
include 'header.php';



if(isset($_POST['add']))
{
    $dbhost = 'localhost';
    $username1 = 'root';
    $password1 = '';
    $db = 'qlms-db';
    $conn = new mysqli ( $dbhost,$username1, $password1, $db );

    $stuid1 = $_GET['stuid'];
    $query1="SELECT * FROM student_info WHERE stuid= $stuid";
    $result1 = mysqli_query($conn, $query1);
    if(isset($_GET['$stuid']))
    {mysqli_fetch_row($result1)[1];}
    if($result1==0){
    $sFname=$_POST['sFname'];
    $sLname=$_POST['sLname'];
    $semail=$_POST['semail'];
    $sphone=$_POST['sphone'];
    $stuid=$_POST['stuid'];
    $stupass=$_POST['stupass'];
    $sbankname=$_POST['sbankname'];
    $saccname=$_POST['saccname'];
    $siban=$_POST['siban'];
    $sauthorize=$_POST['sauthorize'];
    $sBcountry=$_POST['sBcountry'];
    $sother=$_POST['sother'];




             $query12= "INSERT INTO student_info(Fname, Lname, email, phone, stuid, stupass,"
                     . " bankname, accname, iban,authorize,Bcountry,other) "
                     . "VALUES ('$sFname', '$sLname', '$semail', $sphone, '$stuid', '$stupass', "
                     . "'$sbankname', '$saccname', $siban, $sauthorize, '$sBcountry', '$sother')";
                     $res = mysqli_query($conn, $query12);

            //STEP 6: Check the result
            if($res==1)
            {
                $status = "done";
            }
            else
            {
                $status = "notdone";
            }

            }
        }

?>
<html>

    <head>
        <script>
            function stuRegValidation()
            {
                var stuid = document.registration.stuid;
                var stupass = document.registration.stupass;
                var sFname = document.registration.sFname;
                var sLname = document.registration.sLname;
                var sbankname = document.registration.sbankname;
                var sBcountry = document.registration.sBcountry;
                var sphone = document.registration.sphone;
                var semail = document.registration.semail;
                var saccname = document.registration.saccname;
                var siban = document.registration.siban;
                var sauthorize = document.registration.sauthorize;
                var sother = document.registration.sother;
                var valid=true;

                if(stuid == "")
                {
                    valid=false;
                    estuid.style.visibility = "visible";
                }
                else
                {
                    estuid.style.visibility = "hidden";
                }

                if(stupass == "")
                {
                    valid=false;
                    estupass.style.visibility = "visible";
                }
                else
                {
                    estupass.style.visibility = "hidden";
                }

                if(sFname == "")
                {
                    valid=false;
                    esfname.style.visibility = "visible";
                }
                else
                {
                    esfname.style.visibility = "hidden";
                }

                if(sLname == "")
                {
                    valid=false;
                    eslname.style.visibility = "visible";
                }
                else
                {
                    eslname.style.visibility = "hidden";
                }

                if(sbankname == "")
                {
                    valid=false;
                    esbankname.style.visibility = "visible";
                }
                else
                {
                    esbankname.style.visibility = "hidden";
                }

                if(sBcountry.selected.value() === "Default")
                {
                    valid=false;
                    esBcountry.style.visibility = "visible";
                }
                else
                {
                    esBcountry.style.visibility = "hidden";
                }

                if(sphone == "")
                {
                    valid=false;
                    esphone.style.visibility = "visible";
                }
                else
                {
                    esphone.style.visibility = "hidden";
                }

                if(semail == "")
                {
                    valid=false;
                    esemail.style.visibility = "visible";
                }
                else
                {
                    esemail.style.visibility = "hidden";
                }

                if(saccname == "")
                {
                    valid=false;
                    esaccname.style.visibility = "visible";
                }
                else
                {
                    esaccname.style.visibility = "hidden";
                }

                if(siban == "")
                {
                    valid=false;
                    esiban.style.visibility = "visible";
                }
                else
                {
                    esiban.style.visibility = "hidden";
                }

                if(sauthorize == "")
                {
                    valid=false;
                    esauthorize.style.visibility = "visible";
                }
                else
                {
                    esauthorize.style.visibility = "hidden";
                }

                if(valid)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

        </script>
    </head>
    <body>
        <div id="wrapper">
        <div id="inside">
        <div class="row"><!--second row-->
            <div class="reg_col">
                <?php if(isset($_GET['status']) && $_GET['status']==="done") { ?>
                <p>Item added successfully to the Database</p>
                    <?php } else {if(isset($_GET['status']) && $_GET['status']==="notdone") { ?>
                <p>Sorry Item was not added</p>
                <?php } else { ?>
                <form name='registration' onSubmit="return stuRegValidation();" method="POST" action="stuReg.php">
                    <h3>PERSONAL INFORMATION</h3>
                    <ul>
                        <li><label for="sFname">First Name:</label></li>
                        <li><input type="text" name="sFname" /></li>
                        <span class="error" id="esfname">* Required </span>
                        <li><label for="sLname">Last Name:</label></li>
                        <li><input type="text" name="sLname"/></li>
                        <span class="error" id="eslname">* Required </span>
                        <li><label for="semail">Email:</label></li>
                        <li><input type="email" name="semail" /></li>
                        <span class="error" id="esemail">* Required </span>
                        <li><label for="sphone">Phone Number:</label></li>
                        <li><input type="number" name="sphone"/></li>
                        <span class="error" id="esphone">* Required </span>
                    </ul>
                        <br>
                    <h3>LOGIN INFORMATION</h3>
                    <ul>
                        <li><label for="stuid">Student id:</label></li>
                        <li><input type="text" name="stuid" /></li>
                        <span class="error" id="estuid">* Required </span>
                        <li><label for="stupass">Password:</label></li>
                        <li><input type="password" name="stupass" /></li>
                        <span class="error" id="estupass">* Required </span>
                    </ul>
                        <br>
                    <h3>PAYMENT INFORMATION</h3>
                    <ul>
                        <li><label for="sbankname">Bank Name:</label></li>
                        <li><input type="text" name="sbankname" /></li>
                        <span class="error" id="esbankname">* Required </span>
                        <li><label for="saccname">Name on the Account:</label></li>
                        <li><input type="text" name="saccname" /></li>
                        <span class="error" id="esaccname">* Required </span>
                        <li><label for="siban">IBAN Number:</label></li>
                        <li><input type="number" name="siban"/></li>
                        <span class="error" id="esiban">* Required </span>
                        <li><label for="sauthorize">Authorization Code:</label></li>
                        <li><input type="number" name="sauthorize"/></li>
                        <span class="error" id="esauthorize">* Required </span>
                        <li><label for="sBcountry">Bank Branch:</label></li>
                        <li><select name="sBcountry">
                                <option selected="" value="Default">(Please select a Bank Branch)</option>
                                <option value="AF">Australia</option>
                                <option value="AL">Canada</option>
                                <option value="DZ">India</option>
                                <option value="AS">Suadi Arabia</option>
                                <option value="AD">USA</option>
                            </select>
                            <span class="error" id="esBcountry">* Required </span>
                        </li>
                    </ul>
                        <br>
                    <h3>OTHER INFORMATION</h3>
                    <ul>
                        <li><label for="sother">Where did you hear about us:</label></li>
                        <li><input type="radio" name="sother" value="Friend" /><span>Friend</span></li>
                        <li><input type="radio" name="sother" value="Social" /><span>Social Media</span></li>
                        <li><input type="radio" name="sother" value="news" /><span>Newspaper</span></li>
                        <li><input type="radio" name="sother" value="ads" /><span>Advertisement</span></li>
                        <li><input type="radio" name="sother" value="other" /><span>Other</span></li>
                    </ul>
                        <br>
                    <input type="submit" name="submit" value="Submit"/>
                </form>
                 <?php } } ?>
            </div>
        </div>
        </div>
        <?php include 'footer.php'; ?>
        </div>
    </body>
</html>





What I have tried:



i tried using sessions,, cookies, connecting by statement and adding it to the query but nothing seems to be working



What I have tried:

i tried using sessions,, cookies, connecting by statement and adding it to the query but nothing seems to be working

推荐答案




这篇关于我的插页中我做错了什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-20 21:32