Changing an array of checkboxes to a single dropdown menu

Discussion in 'PHP' started by allentram, Oct 20, 2012.

  1. #1
    Hi everyone, just getting into PHP and need to get pointed in the right direction.

    I am trying to convert an array of checkboxes to a single dropdown menu. The checkboxes are being called in div .carttd6 Any help will be greatly appreciated!

    Below is the snippet of code I am working on:

    
    <?
    $e=0;
    $getRsss = mysql_query("SELECT optionals.* FROM optionals,optional_product where optional_product.prodid=".$rsp['id']." and optional_product.optid=optionals.id order by optional asc");
    while ($rsss = @mysql_fetch_array($getRsss)) {
    $e++;
    
    
    if (in_array($rsss['id'],$extras_array)) $extra_total=$extra_total+($rsss['price']*$rss['qty']);
    
    
    if ($e==1) {
    ?>
    <div class="carttr2">
      <div class="carttd5"><!--tdcolspan4--><br clear="all" />
        <i>
        <?=$GLOBALS['extras']?>
        </i></div>
      <!--endtd5--> 
    </div>
    <!--endtr2-->
    <? } ?>
    <div class="carttr3">
      <div class="carttd6" style="vertical-align:middle;line-height:14px;">
        <input type="checkbox" name="extra_<?=$rsss['id']?>" id="extra_<?=$rsss['id']?>" value="<?=$rsss['id']?>" class="extras_cb cb_<?=$rss['id']?>" onclick="updateExtras(<?=$rss['id']?>);" <? if (in_array($rsss['id'],$extras_array)) echo "checked='true'"; ?>  />
        <?=$rsss['optional']?>
        [
        <?=setPrice($rsss['price']);?>
        ]</div>
      <!--endcarttd6-->
      <div class="carttd7" style="width:20px;"></div>
      <div class="carttd8" style="text-align:right;width:50px;"></div>
      <div class="carttd9" style="width:10px;"></div>
    </div>
    <? } 
    }?>
    
    Code (markup):
    Attached is the full file, thanks in advance for any help provided.

    Cheers
     

    Attached Files:

    allentram, Oct 20, 2012 IP