欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP簡(jiǎn)單處理表單輸入的特殊字符的方法

 更新時(shí)間:2016年02月03日 11:43:46   作者:不是JS  
這篇文章主要介紹了PHP簡(jiǎn)單處理表單輸入的特殊字符的方法,涉及PHP中trim(),strip_tags(),htmlspecialchars()及addslashes()等函數(shù)的使用技巧,需要的朋友可以參考下

本文實(shí)例講述了PHP簡(jiǎn)單處理表單輸入的特殊字符的方法。分享給大家供大家參考,具體如下:

<html>
<body>
  <?php
   if ($_POST['submitted'] == "yes"){
    $yourname = $_POST['yourname'];
    $yourname = trim ($yourname);
    $yourname = strip_tags ($yourname);
    $yourname = htmlspecialchars ($yourname);
    $yourname = addslashes ($yourname);
    echo $yourname . "<br />";
    ?><a href="index.php">Try Again</a><?php
   }
   if ($_POST['submitted'] != "yes"){
    ?>
    <form action="index.php" method="post">
     <p>Example:</p>
     <input type="hidden" name="submitted" value="yes" />
     Your Name: <input type="text" name="yourname" maxlength="150" /><br />
     <input type="submit" value="Submit" style="margin-top: 10px;" />
    </form>
    <?php
   }
  ?>
 </div>
</body>
</html>

更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《php字符串(string)用法總結(jié)》、《PHP運(yùn)算與運(yùn)算符用法總結(jié)》、《PHP基本語(yǔ)法入門教程》及《php防止SQL注入方法總結(jié)

希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論