[英]how to post selected check box with each text box value
i want insert post text box values of each selected check boxes to the database. 我想将每个选定复选框的帖子文本框值插入数据库。
<input type="checkbox" name="email[]" value="<?php echo $actions_to_be[$z]['student_email'] ?>" />
<input type="text" name="timetable_id[]" value="<?php echo $actions_to_be[$z]['timetable_id'] ?>" size="10px"/>
<input type="text" name="sid[]" value="<?php echo $actions_to_be[$z]['sid'] ?>" size="10px" />
<input type="checkbox" name="email[]" value="<?php echo $i; ?>" />
<input type="text" name="timetable_id[<?php echo $i; ?>]" value="<?php echo $actions_to_be[$z]['timetable_id'] ?>" size="10px"/>
<input type="text" name="sid[<?php echo $i; ?>]" value="<?php echo $actions_to_be[$z]['sid'] ?>" size="10px" />
$i
should be increased for every box of course. 当然,每增加一箱,
$i
应该增加。 Then you can simply take the ids from the $_POST['email']
array (possibly rename it to something more meaningful though) and retrieve the values in $_POST['timetable_id'][$id]
and $_POST['sid'][$id]
. 然后,您可以简单地从
$_POST['email']
数组中获取ID(尽管可能将其重命名为更有意义的名称),然后检索$_POST['timetable_id'][$id]
和$_POST['sid'][$id]
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.