如何在php中保留回传表单中复选框的选定值 [英] how to Retaining selected value of checkboxes in postback form in php

查看:59
本文介绍了如何在php中保留回传表单中复选框的选定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,

我有这个简单的表格



Dear Friends,
I have this simple form

<table  align="left" cellpadding="3" cellspacing="0" width="550" border="0">
          <form action="" name="WebToLeadForm" method="post" id="WebToLeadForm" onsubmit="javascript: return form_validation();">







<tr>
                <td colspan="2" ><strong>What digital printing equipment do you have? </strong></td>
              </tr>
              <tr>
                <td >HP: </td>
                <td ><input id="printerhp_c" name="printerhp_c" type="checkbox" value="HP" value="<?php echo htmlentities($hp) ?>" />
                </td>
              </tr>
              <tr>
                <td >Xerox: </td>
                <td ><input id="printerxerox_c" name="printerxerox_c" type="checkbox" value="Xerox" value="<?php echo htmlentities($xerox) ?>" />
                </td>
              </tr>
              <tr>
                <td >Konica Minolta: </td>
                <td style="font-weight: normal;"><input id="printer_konicam_c" name="printer_konicam_c" type="checkbox" value="Konica Minolta" value="<?php echo htmlentities($km) ?>"/>
                </td>
              </tr>
              <tr>
                <td >Canon: </td>
                <td ><input id="printercanon_c" name="printercanon_c" type="checkbox" value="Canon"  value="<?php echo htmlentities($canon) ?>" />
                </td>
              </tr>
              <tr>
                <td >Kodak<span sugar="slot">: </span></td>
                <td ><input id="printerkodak_c" name="printerkodak_c" type="checkbox" value="Kodak"  value="<?php echo htmlentities($kodak) ?>"/>
                </td>
              </tr>
              <tr>
                <td >Ricoh: </td>
                <td ><input id="printerricoh_c" name="printerricoh_c" type="checkbox" value="Ricoh"  value="<?php echo htmlentities($ricoh) ?>" />
                </td>
              </tr>
              <tr>
                <td >Oc&eacute;: </td>
                <td ><input id="printeroce_c" name="printeroce_c" type="checkbox" value="Océ"   value="<?php echo htmlentities($oce) ?>"/>
                </td>
              </tr>
              <tr>
                <td >Other: </td>
                <td ><input id="printerother_c" name="printerother_c" type="checkbox" value="Other"  value="<?php echo htmlentities($other) ?>" />
                </td>
              </tr>





< / form>





当我提交表单并且代码出错并且页面刷新/重定向所有复选框保持选中时,我只是想要这样做。



提前支付
预付款。

随着问候

Rajesh



</form>


I just want that when i submit the form and code went wrong and page refresh/redirect all checkbox remain checked.

Thannks in
advance.
With Regards
Rajesh

推荐答案

hp)?> / >
< / td >
< / tr >
< tr >
< td > Xerox:< / td >
< td > < input id = printerxerox_c n ame = printerxerox_c type = 复选框 value = Xerox value = <?php echo htmlentities(
hp) ?>" /> </td> </tr> <tr> <td >Xerox: </td> <td ><input id="printerxerox_c" name="printerxerox_c" type="checkbox" value="Xerox" value="<?php echo htmlentities(


xerox)?> / >
< / td >
< / tr >
< tr >
< td > 柯尼卡美能达:< / td >
< td style = font-weight:normal; > < 输入 id = printer _konicam_c 名称 = printer_konicam_c type = 复选框 = 柯尼卡美能达 value = <?php echo htmlentities(
xerox) ?>" /> </td> </tr> <tr> <td >Konica Minolta: </td> <td style="font-weight: normal;"><input id="printer_konicam_c" name="printer_konicam_c" type="checkbox" value="Konica Minolta" value="<?php echo htmlentities(


km)?> / >
< / td >
< / tr >
< < span class =code-leadattribute> tr >
< td > 佳能:< / td >
< span class =code-keyword>< td > < input id = printercanon_c nam e = printercanon_c type = 复选框 value = Canon value = <?php echo htmlentities(
km) ?>"/> </td> </tr> <tr> <td >Canon: </td> <td ><input id="printercanon_c" name="printercanon_c" type="checkbox" value="Canon" value="<?php echo htmlentities(


这篇关于如何在php中保留回传表单中复选框的选定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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