是否可以在php中提交没有提交按钮的复选框形式? [英] Is it possible to submit a checkbox form without submit button in php?
本文介绍了是否可以在php中提交没有提交按钮的复选框形式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是php新手,我正在尝试为我的电子商务网站项目创建一个价格范围系统.
I am a php newbie and i am trying to create a price range system for my ecommerce website project.
所以我做了一个复选框:
so I did a checkbox form:
<form method="POST" action="?">
<p> <input type="checkbox" name="dori" value="dori"><em> 0 - 5000</em></p>
<p><input type="checkbox" name="bora" value="bora"><em> 5000 - 1000</em></p>
<input type="submit">
</form>
对于那没问题,我可以处理...但是我想要实现的是,如果用户在框上打钩,我可以在不单击提交按钮的情况下获得框的值.
For that no problem, i can handle it...But what i want to achieve is if the user ticked the box, i can get the value of the box ticked without a submit button clicked.
我该如何实现?
这是我想要实现的形式
<form method="POST" action="?">
<p> <input type="checkbox" name="dori" value="dori"><em> 0 - 5000</em></p>
<p><input type="checkbox" name="bora" value="bora"><em> 5000 - 1000</em></p>
</form>
希望我能清楚地解释...谢谢您的帮助!
Hope i explain clearly...Thanks in advance for the help!
推荐答案
在onchange中添加javascript函数commit()
Add javascript function submit() in onchange
<form method="POST" action="?">
<p><input type="checkbox" name="dori" value="dori" onchange="this.form.submit()"><em> 0 - 5000</em></p>
<p><input type="checkbox" name="bora" value="bora" onchange="this.form.submit()"><em> 5000 - 1000</em></p>
</form>
这篇关于是否可以在php中提交没有提交按钮的复选框形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文