Need some help *URGENT*

Discussion in 'HTML & Website Design' started by whizzkid-000, Mar 19, 2008.

  1. #1
    Hello so i have been trying to get this working for some time. So would greatly appreciate any help given.
    I have to add contents to a shopping cart(database table) for a website and currently having diffficulty getting the information from the product listing page to the cart/database table. I have been trying to get the information via the 'add to cart' button like this:

    echo "<form action='addtocart.php?description={$dvd_name}' method='get'>";
    echo "Quantity: <input type='number' size='10' name='quantity'></input>";
    echo "<br />";
    echo "<input type='submit' value='Add To Cart'></input>";
    echo "</form>";



    Here is my PHP to add the data from the item listing page to the cart.
    <?php
    $host = "1**.*.0.1";
    $user = "102***22";
    $password = "v***ie";
    $database = "1****122";

    $getdescription = $_GET ['description'];
    echo $getdescription;
    //connect to MySQL
    $connect = mysql_connect($host, $user, $password )
    or die("Hey loser, check your server connection.");

    //make sure we're using the right database
    mysql_select_db($database);

    $query3 = 'SELECT dvd_name, genre, dvdpic_1, price, delivery, availability, release_date, quantity, description, certificate
    FROM dvd_table
    WHERE dvd_name="'.$getdescription.'";';
    echo $dvd_name;
    echo $query3;

    $getchosenitem = mysql_query($query3)
    or die (mysql_error());

    $displaychosenitem = mysql_fetch_array($getchosenitem);
    extract($displaychosenitem);

    echo $getdescription;

    ?>

    And this is what i am getting:
    Notice: Undefined index: description in HOMEDIRS:/htdocs/*******_Web/E-Business/addtocart.php on line 7

    Notice: Undefined variable: dvd_name in HOMEDIRS:/htdocs/******_Web/E-Business/addtocart.php on line 19
    SELECT dvd_name, genre, dvdpic_1, price, delivery, availability, release_date, quantity, description, certificate FROM dvd_table WHERE dvd_name="";
    Warning: extract() [function.extract]: First argument should be an array in HOMEDIRS:/htdocs/1******_Web/E-Business/addtocart.php on line 26

    Am i going about this the wrong way?
     
    whizzkid-000, Mar 19, 2008 IP