亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP 開(kāi)発企業(yè) Web サイトのチュートリアル: 連絡(luò)先情報(bào)の追加

まず、次の追加ページの HTML コードを見(jiàn)てみましょう:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加公司信息</title>
    <style type="text/css">
        .ipt{width:180px;height:30px;border-radius:5px;
            outline:none;border:1px solid #eee;box-sizing:border-box;padding-left:15px;}
        .txt{width:250px;height:200px;}
        .sub{width:50px;height:20px;border:1px solid #eee;background:#eee;color:#ff7575;}
    </style>
</head>
<body>
    <form method="post" action="addcontact.php">
        公司地址:<input type="text" name="site" class="ipt"></br></br>
        公司電話:<input type="text" name="tel" class="ipt"></br></br>
        技術(shù)支持:<input type="text" name="suppot" class="ipt"></br></br>
        售后電話:<input type="text" name="nexttel" class="ipt"></br></br>
        公司傳真:<input type="text" name="fax" class="ipt"></br></br>
        公司主頁(yè):<input type="text" name="home" class="ipt"></br></br>
        電子郵件:<input type="text" name="email" class="ipt"></br></br>
        <input type="submit" value="添加" class="sub">
    </form>
</body>
</html>

上記のコードを見(jiàn)ると、フォームは addcontact.php ファイルに送信され、フォームによって送信されたパラメーターを受け取り、それをSQL ステートメントに従ってデータベースを作成します

コードの addcontact .php 部分を見(jiàn)てみましょう:

<?php
    //添加聯(lián)系我們信息部分代碼
    require_once('conn.php');
    $site    = $_POST['site']; //地址
    $tel     = $_POST['tel'];    //電話
    $suppot  = $_POST['suppot'];//技術(shù)支持
    $nexttel = $_POST['nexttel'];//售后電話
    $fax     = $_POST['fax'];        //公司傳真
    $home    = $_POST['home'];        //公司首頁(yè)
    $email   = $_POST['email'];    //電子郵件
    if(empty($site)){
        echo "<script>alert('請(qǐng)?zhí)顚?xiě)地址');history.go(-1);</script>";
    }else if(empty($tel)){
        echo "<script>alert('請(qǐng)?zhí)顚?xiě)電話');history.go(-1);</script>";
    }else if(empty($suppot)){
        echo "<script>alert('請(qǐng)?zhí)顚?xiě)技術(shù)支持');history.go(-1);</script>";
    }else if(empty($nexttel)){
        echo "<script>alert('請(qǐng)?zhí)顚?xiě)售后電話');history.go(-1);</script>";
    }else if(empty($fax)){
        echo "<script>alert('請(qǐng)?zhí)顚?xiě)公司傳真');history.go(-1);</script>";
    }else if(empty($home)){
        echo "<script>alert('請(qǐng)?zhí)顚?xiě)公司首頁(yè)');history.go(-1);</script>";
    }else if(empty($email)){
        echo "<script>alert('請(qǐng)?zhí)顚?xiě)電子郵件');history.go(-1);</script>";
    }else{
        $sql  = "insert into `contact`(site,tel,suppot,nexttel,fax,home,email) values('$site','$tel','$suppot','$nexttel','$fax','$home','$email')";
        $res = mysql_query($sql);
        if($res){
            echo "<script>alert('添加公司信息成功');location.href='contact.php';</script>";
        }else{
            echo "<script>alert('添加公司信息失敗');history.go(-1);</script>";
        }
    }
?>

上記のコードに示すように、フォーム內(nèi)の情報(bào)を空にすることはできません??栅摔筏扑托扭工毪取ⅴ抓恁螗抓去幞氓哗`ジが表示されます

學(xué)び続ける
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>添加公司信息</title> <style type="text/css"> .ipt{width:180px;height:30px;border-radius:5px; outline:none;border:1px solid #eee;box-sizing:border-box;padding-left:15px;} .txt{width:250px;height:200px;} .sub{width:50px;height:20px;border:1px solid #eee;background:#eee;color:#ff7575;} </style> </head> <body> <form method="post" action="addcontact.php"> 公司地址:<input type="text" name="site" class="ipt"></br></br> 公司電話:<input type="text" name="tel" class="ipt"></br></br> 技術(shù)支持:<input type="text" name="suppot" class="ipt"></br></br> 售后電話:<input type="text" name="nexttel" class="ipt"></br></br> 公司傳真:<input type="text" name="fax" class="ipt"></br></br> 公司主頁(yè):<input type="text" name="home" class="ipt"></br></br> 電子郵件:<input type="text" name="email" class="ipt"></br></br> <input type="submit" value="添加" class="sub"> </form> </body> </html>
提出するリセットコード