通过购物篮过程传递勾号框 [英] Pass tick boxes through basket process

查看:102
本文介绍了通过购物篮过程传递勾号框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个自定义购物篮 - http ?://www.dtrmedical.com/test-site/index.php ID = 3及的productid = 130 。我想将选中的复选框选项传递给另一个表单。



我有两种表示篮子的两个阶段的形式:


  1. 要查看第一个表单,请点击添加至意愿清单按钮。选中一些选项,然后点击底部的添加至愿望清单按钮。

  2. 要查看第二个表单,请点击绿色的愿望清单按钮。这将显示所选的选项。

我想显示第一个表单中打勾的选项,在第二种形式。我怎么能这样做?



如果您希望看到完整的代码 - http://pastebin.com/W3UVSSEx



第一种形式始于197行,第二种形式始于行276。 / p>

两种形式的复选框都以这种方式显示:

 < ; input type =checkbox
name =< ;? echo $ productid。_。$ product_quantity [id]。_。$ product_option [id];?>
value =< ;? echo $ quote [qty];?>
/>

< input type =checkbox
name =< ;? echo $ productid。_。$ product_quantity [id]。_。$ product_option [id]; ?>中
value =< ;? echo $ sample [qty];?>
/>

我试过使用 isset ,但我不知道要检查什么,因为我的复选框名称是变量。

当您构建第二个表单时,构建您的复选框的方式与第一种方法相同,当你从循环中写入HTML并将checked =checked复制到每个复选框时,它们将被设置为例:

这是如何定义复选框的名称



$ item [pid]。_。$ item [qid]。 _。$ item [oid]



所以在循环中产生这种检查就像这样

  if(isset($ _post [$ item [pid]。_。$ item [qid]。_。$ item [oid]])) {
//使用checked =checked构建您的复选框HTML;
} else {
//构建您的普通复选框(未选中)
}


I'm working on a custom basket - http://www.dtrmedical.com/test-site/index.php?id=3&productid=130. I want to pass the checkbox options chosen from one form to the other.

I have two forms that represent two stages of a basket:

  1. To see the first form click the "add to wish list button". Check some options then click the "add to wish list" button at the bottom.
  2. To see the second form, click the green "wish list button". This will show the options that were chosen.

I want to show the options that were ticked in the first form, ticked on the second form. How could I do this?

Should you wish to see the code in it's entirety - http://pastebin.com/W3UVSSEx

The first form starts on line 197 and the second on line 276.

The checkboxes in both forms are displayed in this manner:

<input type="checkbox" 
       name="<? echo $productid."_".$product_quantity[id]."_".$product_option[id]; ?>" 
       value="<? echo $quote[qty]; ?>" 
/>

<input type="checkbox" 
       name="<? echo $productid."_".$product_quantity[id]."_".$product_option[id]; ?>" 
       value="<? echo $sample[qty]; ?>" 
/>

I've attempted to use isset but I'm not sure what to check against as my checkbox names are variables.

解决方案

When you build your second form, build your checkbox the same way has you build on the first, and when you write the HTML from the loop andd checked="checked" to every checkbox who return that they are set exemple :

This is how the name of the checkbox are defined

$item[pid]."_".$item[qid]."_".$item[oid]

so in the loop that generate that just check like this

if (isset($_post[$item[pid]."_".$item[qid]."_".$item[oid]])) { 
 //Build your checkbox HTML with the checked="checked";
} else { 
 // Build your normal checkbox (unticked)
}

这篇关于通过购物篮过程传递勾号框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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