How to set HTML value attribute (with spaces)

后端 未结 5 981
日久生厌
日久生厌 2020-11-27 08:08

When I use PHP to set the value of a HTML form input element, it works fine provided I don\'t have any spaces in the data.



        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 08:16

    As you see its not PHP5 or even PHP question at all.
    Basic HTML knowledge is obligatory for one who want to be a PHP user.

    And with using templates it looks way more neat:

    Getting data part code:

    $username = "";
    if isset($_POST['username'])) $username = htmlspecialchars($_POST["username"]);
    

    And template code:

    
    

    If you divide your code to 2 parts it become way more supportable and readable.

提交回复
热议问题