Php $_POST method to get textarea value

前端 未结 8 1294
一整个雨季
一整个雨季 2021-02-01 08:45

I am using php to get textarea value using post method but getting a weird result with that let me show you my code

8条回答
  •  抹茶落季
    2021-02-01 09:26

    Make sure your escaping the HTML characters

    E.g.

    // Always check an input variable is set before you use it
    if (isset($_POST['contact_list'])) {
        // Escape any html characters
        echo htmlentities($_POST['contact_list']);
    }
    

    This would occur because of the angle brackets and the browser thinking they are tags.

    See: http://php.net/manual/en/function.htmlentities.php

提交回复
热议问题