Results 1 to 5 of 5

Thread: Drop downs that sum together?

  1. #1
    Join Date
    May 2009

    Drop downs that sum together?

    Ok, first off this is my first post and I am a TOTAL noob when it comes to php. with that said I am trying to write a site and have stole various snippets online and have gotten certain things to work but the code probably looks hideous.

    Basically what I want from this site is the ability to connect to amazon and get pricing updates (I am grabbing computer parts pricing)*this part I have done*

    Next, instead of the way that I current have the information shown in tables I would rather have the information in numerous drop down boxes with somebody able to select items from those boxes. After the items are selected I would like to add the totals together on the fly or with a submit button. (I have a feeling I might need Javascript to do this?)

    Also I need each drop down to have different items (like 1 drop down would have video card names and prices, the 2nd would have sound card names and prices, etc.) My question here is how do I do this with mysql table? do I need multiple tables to accomplish this?

    Anyway thats enough for now and hopefully I was as clear as I could be on what I am looking to do. Here is what I currently have

    include "connect.php";
    $getitems="SELECT itemid,ibsn from amz";
    $getitems2=mysql_query($getitems) or die("Could not get items");
      //print "$realprice<br>";
      $updatecron="Update amz set price='$realprice' where itemid='$getitems3[itemid]'";
      mysql_query($updatecron) or die("Could not update cron");
      mysql_query("Delete from bgook");
    $connect = mysql_connect("localhost", "games45", "3000gtgt") or
    die ("Hey, check your server connection.");
    $quey1="select * from amz";
    $result=mysql_query($quey1) or die(mysql_error());
    <table border=1 style="background-color:#F0F8FF;" >
    <caption><EM>Current Prices</EM></caption>
    echo "</td><td>";
    echo $row['productname'];
    echo "</td><td>";
    echo $row['price'];
    echo "</td>";
    echo "</tr>";
    echo "</table>";

  2. #2
    Join Date
    May 2009
    wow, I thought this was gonna be an easy one for the PHP guru's. I guess what I'm asking isn't possible then?

  3. #3
    Join Date
    May 2009
    let me try to start with something easier.

    If i have this code below

    PHP Code:
    while ($row=mysql_fetch_array($result)) {


                <SELECT NAME=price><?=$options?></SELECT>

    What is the proper syntax to get both $Productname and $Price on the same line in the drop down box? I seem to only be able to show 1 or the other.

  4. #4
    Join Date
    Nov 2002
    Baltimore, Maryland
    $options .= "<OPTION>$Productname @ Price</OPTION>"
    and like Java, php naming conventions don't capitolize variable names.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  5. #5
    Join Date
    May 2009
    NICE! that worked, thanks.

    Now I just have to figure out how to parse the $price part out of each line that is selected by the user, so they can be added together

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