form action ='file.php' - 不调用file.php [英] form action='file.php' - not calling file.php

查看:79
本文介绍了form action ='file.php' - 不调用file.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表单代码



 <  表格 >  

< 选择 名称 = 选择 >
< 选项 = > < / option >
< 选项 value = 小说 < span class =code-keyword>> 小说< / option >
< 选项 < span class =code-attribute> value = journals > 期刊< / option >
< 选项 value = acadamic > acadamic < / option >
< / select >



< 表格 action = result.php 方法 = POST >

< 输入 类型 = text value = name = q size = 10 id = searchfield title = searchfield onFocus = clearText(this) onBlur = clearText(this) / >
< input type = 提交 name = 搜索 < span class =code-attribute> value = alt = 搜索 id = searchbutton title = 搜索 / >

< ; / form >
< / form >



问题是我什么时候尝试提交按钮动作不是要求

result.php

解决方案

禁止和不支持嵌套表单标签(您可以有多个表单标签但不能嵌套),因此在您的情况下,浏览器会取消第二个(内部)表单标签,并且不会行动发生了......

删除第一个(外部)表单标签以使代码工作......

(当然它与PHP无关 - 它与HTML有关)

form code

<form>

 <select name="select">
<option value="empty">none</option>
    <option value="fiction">fiction</option>
<option value="journals">journals</option>
<option value="acadamic">acadamic</option>
</select>



            <form action="result.php" method="POST">
 
           <input type="text" value=" " name="q" size="10" id="searchfield" title="searchfield" onFocus="clearText(this)" onBlur="clearText(this)" />
                    <input type="submit" name="Search" value="" alt="Search" id="searchbutton" title="Search" />

</form>
            </form>


Problem is when ever I try to submit a button action is not calling to
result.php

解决方案

It is forbidden and unsupported to nest form tags (you can have multiple form tags but not nested), so in your case the browser dismissed the second (inner) form tag and for that no action took place...
Remove the first (outer) form tag to make your code work...
(And of course it has nothing to do with PHP - it is HTML related)


这篇关于form action ='file.php' - 不调用file.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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