well hello guys want to ask for your help in improving this code. Please help me. First things first I have a database name called quotation and it has 4 fields namely Id, Date, Product and Price. Well I want to get the name of the product in the drop down and its corresponding price then store it in the database. My teacher told me I'll be using arrays but I don't really know how to use it specially that I'm new with this kind. Please help me :) thanks in advance




        $query="INSERT into quotation(Id, Date, Product, Price) VALUES ('', '$date', 
        '$cabbage', '$prcabbage', '$beans', '$prbeans', '$carrots','$prcarrots')";


            echo "Data Sent!";
            echo "Error";
    <table border="1" cellpadding="2">
    <form name="form" method="get" action="form.php">

        <label>Date of quotation</label>
        <input type="text" name="date"><br/>

        <th>Bid Price</th>

        <td><select name="cabbage">
        <td><input type="text" name="PRcabbage"></td>

        <td><select name="beans">
        <td><input type="text" name="PRbeans"></td>

        <td><select name="carrots">
        <td><input type="text" name="PRcarrots"></td>
        <input type="Submit" name="submit" value="submit">


Recommended Answers

All 2 Replies

Member Avatar

Ok, it looks as though your table is set up incorrectly, try to make it as easy to update as possible. You'll be better off doing something like this:

product_id (Primary Key, int)
productname (varchar (20))
price (float?)

ah ok, thanks. But how do you actually get the values from every drop down you created and insert them into your database?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.