Jump to content

Order Form help


Jager

Recommended Posts

Hi guys, i'm having trouble with making a order form for my school assignment, i'm trying to get it so that it gets the product number from one of the tables to show in a drop down box thingy any help would be greatly appricated. the code is below:

 

<form name="Place an Order" method="post" action="order2.php "></center>

    <center><p>Enter the Product ID of the product you wish to purchase <a href="product.php" target="content">(cant remember? click here)</a>:  <input name="ProductID" type="select" value="$query=mysql_query("SELECT ProductID FROM Products ORDER BY ProductName ASC") or die(mysql_error());

print("<select name=\"productid\">\n");

while ($row = mysql_fetch_row($query)) {

  printf("<option value=\"*" selected>*</option>\n", $row[0], $row[1]);

}

print("</select><br>");">"</p>

    <p>Customer ID <a href="Customer.php" target="content">(If you are not already a customer click here)</a>:  <input name="CustomerID" type="text" value="Customer ID"></p>

    <p>Quantity:  <input name="Quantity" type="text" value="99"></p>

    <input name="Place Order" type="submit" value="Place Order">

  </center>

</form>

Link to comment
Share on other sites

trying something like this

<?php
mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db(DB_DATABASE);
  
      if (!isset($_POST['whatever'])) {
        $q = mysql_query("SELECT * FROM table ORDER BY date DESC");
        echo "<select name='whatever'>";
        while ($row = mysql_fetch_assoc($q)) {
          echo '<option value="'.$row['whatever'].'">'.$row['whatever'].'</option>';
        }
        echo "</select>";
      }else {
        print_r($_SERVER);
        print_r($_POST);
      
    ?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.