如何处理HTML表单中的文本? [英] How to process text from HTML form?

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

问题描述

这可能是一个基本问题 -


我的网页上有一个表格如下:


< span id =" site_search">

< form name =" frmSearch"方法= QUOT;交"行动= QUOT;"风格= QUOT;保证金:0 0 0

15px">

搜索本网站:

< input type =" text" name =" search_field">< input name =" Go" type =" submit"

value =" Go" style =" font-family:Arial,Helvetica,sans-serif">

< / form>

< / span>< br />


当用户点击Go时,如何从这个表单中获取输入并使用它来填充另一个表单(在同一站点内的另一个页面上)按钮?

此外,如果表格为空,如何取消任何操作?


提前致谢。

This may be a basic question -

I have a form on my web page that looks like this:

<span id="site_search">
<form name="frmSearch" method="post" action="" style=" margin: 0 0 0
15px ">
Search This Site:
<input type="text" name="search_field"><input name="Go" type="submit"
value="Go" style="font-family:Arial, Helvetica, sans-serif">
</form>
</span><br/>

How do take the input from this form and use it to populate another form (on
another page within the same site) when the user clicks the Go button?
Also, how do I cancel any action if the form is empty?

Thanks in advance.

推荐答案

deko写道:
这可能是一个基本问题 -

我的网页上有一个表格,如下所示:

< span id =" site_search">
< form name =" frmSearch"方法= QUOT;交"行动= QUOT;"风格= QUOT;保证金:0 0 0
15px">
搜索本网站:
< input type =" text" name =" search_field">< input name =" Go" type =" submit"
value =" Go" style =" font-family:Arial,Helvetica,sans-serif">
< / form>
< / span>< br />

当用户点击Go按钮时,如何从这个表单中获取输入并使用它来填充另一个表单(在同一站点内的另一个页面上)?
此外,如果是,如何取消任何操作表格是空的吗?

提前致谢。
This may be a basic question -

I have a form on my web page that looks like this:

<span id="site_search">
<form name="frmSearch" method="post" action="" style=" margin: 0 0 0
15px ">
Search This Site:
<input type="text" name="search_field"><input name="Go" type="submit"
value="Go" style="font-family:Arial, Helvetica, sans-serif">
</form>
</span><br/>

How do take the input from this form and use it to populate another form (on
another page within the same site) when the user clicks the Go button?
Also, how do I cancel any action if the form is empty?

Thanks in advance.




来自用户的输入可以在eiher中找到



The input from user can be found in eiher


_GET或


_POST数据

,具体取决于表单使用的方法。你应该阅读
http:// www .php.net / manual / en / languag ... predefined.php


在你的情况下你可以使用这样的东西:

if(空(
_POST arrays
depending on the method your form uses. You should read
http://www.php.net/manual/en/languag...predefined.php

In you case you can use something like this:
if (empty(


这篇关于如何处理HTML表单中的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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