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
https://forums.phpfreaks.com/topic/212319-order-form-help/
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
https://forums.phpfreaks.com/topic/212319-order-form-help/#findComment-1106320
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.