收集函数中的表单变量并将它们作为单个变量发送
我有一个带有复选框的表格。提交表单时,我想收集单个变量中复选框的所有选中值,并将其与另一个变量一起发送到不同的页面。请帮忙。
<form name="form1" method="get" onsubmit="sendThis()">
<input type=checkbox name="checkbux" value=<from database/>"
<input type=checkbox name="checkbux" value=<from database/>"
<input type=checkbox name="checkbux" value=<from database/>"
<input type=checkbox name="checkbux" value=<from database/>"
<input type="submit" value="Submit">
</form>
function sendThis()
{
var tableName = "<?= $p ?>"; //obtaining the value from another php file
var allVar = a,c,d; //checked values from check boxes
window.location = 'http://localhost/fourthpage.php?q=' + allVar + '&p=' + tableName'
}
I have a form with check boxes. When the form is submitted, I want to collect all the checked values form the check boxes in a single variable and send it to a different page along with another variable. Please help.
<form name="form1" method="get" onsubmit="sendThis()">
<input type=checkbox name="checkbux" value=<from database/>"
<input type=checkbox name="checkbux" value=<from database/>"
<input type=checkbox name="checkbux" value=<from database/>"
<input type=checkbox name="checkbux" value=<from database/>"
<input type="submit" value="Submit">
</form>
function sendThis()
{
var tableName = "<?= $p ?>"; //obtaining the value from another php file
var allVar = a,c,d; //checked values from check boxes
window.location = 'http://localhost/fourthpage.php?q=' + allVar + '&p=' + tableName'
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无需执行 javascript 函数即可实现此目的。像这样
You can achieve this without doing the javascript function. Like this
将其发送到数组中,
例如:
Send it inside an array,
for example: