www.webdeveloper.com
Results 1 to 1 of 1

Thread: get a value from select box

  1. #1
    Join Date
    Jul 2007
    Posts
    49

    get a value from select box

    hello all,

    I am having difficulties getting the current value of a select box to pass to a function

    this is what my code looks like:

    PHP Code:
    <?php 
    $sql 
    dbQuery("SELECT PriceCode, Name FROM pricecode ORDER BY PriceCode");
    $PriceRetail $row_rsProduct['PriceRetail'];
    $pc           $row_rsProduct['PriceCode'];
    $pct           "'".$pc."'";
    $Cost          $row_rsProduct['Cost'];
     while(
    $row dbFetchAssoc($sql))
      {
    ?>
           <option value="<?php echo $row['PriceCode'];?><?php if($row['PriceCode'] == $row_rsProduct['PriceCode']){echo 'selected';}?>><?php echo $row['PriceCode']."|".$row['Name'];?></option>
     <?php 
      
    ?>
    </select></td>
                    <td><input size="7" name="Cost" type="text" id="Cost" style="text-align:right" value="<?php echo $Cost;?>"></td>
                    <td>
      <form name="calc">
        <a class="calc" style="cursor:pointer" onClick="recalc_prompt(<?php echo $ProductId?>,<?php echo $pct?>)">Recalc prices</a>
      </form>

    with this code the variable $pct is only going to be the stored db value - but I need to get the select box current selection value to pass to my function -

    Any Ideas??

    Thanks
    Last edited by samoht; 11-02-2007 at 10:50 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles