PHP $ _POST方法获取textarea值 [英] Php $_POST method to get textarea value

查看:696
本文介绍了PHP $ _POST方法获取textarea值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用php通过post方法获取textarea值,但是得到了一个奇怪的结果,让我向您展示了我的代码

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

<form method="post" action="index.php">
    <textarea id="contact_list" name="contact_list"></textarea>
    <input type="submit" name="submit" value="Send" id="submit"/>
</form>

我在文本区域中输入一些名称及其电子邮件地址,每次我回显值或文本区域时,它都会跳过电子邮件地址,仅显示名称,让我显示我在文本区域中输入值的方式

I am entering some names and their email address in the textarea, and everytime i echo the value or textarea it skips the email address and only showing the name let me show the way i am entering value in textarea

"name1" <name@email.com>, "name2" <name2@email.com> 

一旦我将使用php回显,它将仅回显名称,并跳过电子邮件地址.

and once I will echo using php it will only echo the name and will skip the email address.

推荐答案

总是(总是,总是,我是

Always (always, always, I'm not kidding) use htmlspecialchars():

echo htmlspecialchars($_POST['contact_list']);

这篇关于PHP $ _POST方法获取textarea值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆