ul的形式不发送到$ _POST [英] ul in the form not sending to the $_POST

查看:188
本文介绍了ul的形式不发送到$ _POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单中有这个ul

I have this ul in my form

<form action="step1/" method="post" enctype="multipart/form-data" id="form">
    <div class="tabs">
        <ul>
            <li class="dot clicked radio_buttons"></li>
            <li class="active not_the_dot"><span class="l"></span><a href="#">Standard Class</a><span class="r"></span></li>
            <li class="dot radio_buttons"></li><li class="not_the_dot"><span class="l"></span><a href="#">Business Class</a><span class="r"></span></li>
            <li class="dot radio_buttons"></li><li class="not_the_dot"><span class="l"></span><a href="#">Premium</a><span class="r"></span></li>
        </ul>
....
....
....

然后我在表单中有其他项目,就像

and then i have other items in the form as well like

 <select name="quantity_id" class="quantity_select">
            <option selected="selected" value="0">SELCT STATION QUANTITY</option>
            <option value="1">1 Station</option>
            <option value="2">2 Station</option>
            <option value="3">3 Station</option>
            <option value="4">4 Station</option>
            <option value="5">5 Station</option>
    </select>

并在表单上提交quantity_id存在,但是ul值不是....是我需要改变,以使这个值可用....基本上我需要像标准,业务这样的活动类文本

and on the form submit the quantity_id is present but the ul value is not ....is there something i need to change to make this value available....basically i need the "active" class text like Standard, business

推荐答案

< ul /> 项目不是表单元素,并且在提交表单时不会发布。如果需要捕获这些值,可以将它们存储在隐藏的表单元素中。

<ul/> items are not form elements and will not be posted when the form is submitted. If you need to capture these values you can store them in a hidden form element.

捕获文本的示例

<input type="hidden" id="activeThing" name="activeThing"/>

然后将点击事件绑定到 li

And bind a click event to the li:

$("ul li.not_the_dot").click(function(){
  $("#activeThing").val($(this).find("a").text());
});

这篇关于ul的形式不发送到$ _POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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