简体   繁体   English

在PHP生成HTML中需要帮助

[英]need help in php generating HTML

I was learning to validate form data. 我正在学习验证表单数据。 When I had to write this: 当我不得不写这个时:

"<"form method="post" action=""<"php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"

but when I write this, in output, there is a "> showing at the top of the page. Why? 但是当我编写此代码时,在输出中,页面顶部显示一个"> ,为什么?

Assuming, there is an echo or a print .Change this: 假设有echoprint更改此:

echo "form method="post" action=""<"php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"

to this: 对此:

echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM