2011-10-06 15:54
浏览 24


I'm working on a custom basket - 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 -

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.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

  • doudui5753 2011-10-06 18:31

    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


    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)
    解决 无用
    打赏 举报

相关推荐 更多相似问题