我们可以使用< li>作为html中的表单元素? [英] Can we use <li> as a form element in html?

查看:195
本文介绍了我们可以使用< li>作为html中的表单元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我使用一个列表,其中我尝试使用< li> 元素作为表单的一部分。
我正在做如下所示的事情: -

 < form action =index.phpmethod = post> 
< input type =hiddenname =search-typevalue =commercial>
< ul>
< li name =search-optionid =buyvalue =buy> inputBUY< / li>
< li name =search-optionid =rentvalue =rent> RENT / LEASE< / li>
< li name =search-optionid =pgvalue =pg> PG< / li>
< / ul>
< input type =submitvalue =Submitname =submit>
< / form>

但是当我提交此表单时,在网址中没有出现search-option没有任何值search-option给我的php脚本。



有没有办法做这个没有使用任何< input> ;

不,你必须使用表单控件(输入,选择),以便发送数据到服务器或任何你想要的地方,不是HTML标签


Actually, I am using a list in which I am trying use my <li> element as a part of form. I am doing something like as shown bellow :-

<form action="index.php" method="post">
  <input type="hidden" name="search-type" value="commercial">
    <ul>
    <li name="search-option" id="buy" value="buy">inputBUY</li>
    <li name="search-option" id="rent" value="rent">RENT/LEASE</li>
    <li name="search-option" id="pg" value="pg">PG</li>
    </ul>
  <input type="submit" value="Submit" name="submit">
</form>

But when I submit this form there is no appearance of "search-option" in url means I am not getting any value for "search-option" to my php script.

Is there any way to do this without using any <input > element.

解决方案

No, you must use form controls(inputs,select) in order to send data to the server or whatever place you want, not HTML tags

这篇关于我们可以使用&lt; li&gt;作为html中的表单元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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