[英]How do you validate a html unicode in php
I am passing values from HTML form to a php file for processing我正在将值从 HTML 表单传递到 php 文件进行处理
$to_do = $_POST['action'];
Then i can say那我可以说
<?php
if( $to_do == "delete") {
echo "i will delete for you";
}
?>
Difficulty i am having is when the HTML value is unicode ✘ for a delete symbol.我遇到的困难是当 HTML 值是删除符号的 unicode ✘ 时。 instead of the value "delete".
而不是值“删除”。 In php i cannot tell how to test it.
在 php 中,我不知道如何测试它。
<?php
if( $to_do == "✘") {
echo "i will delete for you";
}
?>
is not working.不管用。 Any one to help me out?
有谁来帮帮我吗?
How are you sending this value to begin with - via something like <input type="submit" value="✘">
?你是如何发送这个值开始的 - 通过像
<input type="submit" value="✘">
?
In that case, I would recommend you switch to a button
element - that can have a separate submission value and display text.在这种情况下,我建议您切换到一个
button
元素——它可以有一个单独的提交值和显示文本。 So you can keep sending delete
, and show ✘
to the user at the same time.所以你可以继续发送
delete
,同时向用户显示✘
。
<button type="submit" value="delete">✘</button>
More details on the button
element can be found in the MDN, https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button关于
button
元素的更多细节可以在 MDN 中找到, https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.