了解自我参考表单 [英] Understanding Self Referencing forms

查看:75
本文介绍了了解自我参考表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习自引用表单。我已经读过嵌入 php 脚本中的 html 表单是自引用表单。我仍然无法选择这个概念。几乎我在 php 代码中看到的所有表单都是使用 html 构建的。是否有更具体的自引用表单,然后嵌入 php 脚本中的 html 表单?

解决方案

您可能是这样的意思:

<?php
if(count($ _ POST)){
echo'您提交了字符串:'。$ _ POST ['string'];
}
?>
< form action =method =post>
< input type =textname =string>
<按钮类型=提交>提交!< /按钮>
< / form>

空操作属性会导致浏览器将其提交到与加载的URL相同的URL。通过 count($ _ POST)我们检查表单是否已提交并采取相应措施。


I am trying to learn Self Referencing Forms. I have read that a html form embedded in a php script is a self referencing form. I am still unable to pick the concept. Almost all the forms that I see in php codes are built with html. Is there something more specific about Self Referencing forms then just html forms being embedded in php script?

解决方案

You probably mean something like this:

<?php
if (count($_POST)) {
echo 'You have submitted the string: '.$_POST['string'];
}
?>
<form action="" method="post">
<input type="text" name="string">
<button type="submit">Submit!</button>
</form>

The empty action attribute causes the browser to submit it to the same URL as the one that is loaded. Via count($_POST) we check whether the form was submitted and act accordingly.

这篇关于了解自我参考表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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