php and html ordering and process order display in view order

why does it not work yet?

this is my orderform.html

[code]

<img src="background.jpg" alt="Smiley face" height="200"
    width="900"></div>
<title> Food Menu and ordering Service</title>
<center>
  <p>&nbsp;</p>

Home Introduction Site Map Job Advertisement History Location News Event Customer Feedback

Table No.:



i would like to buy(1st choice):

Type of product:

<option>Select Item</option>
   <option value="3.60">Basik A - $3.60</option>
   <option value="3.80">Hoopa - $3.80</option>
   <option value="4.50">Chezzy - $4.50</option>
   <option value="2.50">Shroom - $2.50</option>
   <option value="4.50">Akon - $4.50</option>
   <option value="4.00">Rush - $4.00</option>
   <option value="4.50">Bing - $4.50</option>
   <option value="6">Kombo - $6.00</option>
</select>

<br />
<br />


Quantity :
1 2 3 4 5

<button type="submit">Submit Order</button> 


&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Note: After ordering wait for your order to be preserved by our management team.

[/code]

processorder.php
[php]

Food Menu and Ordering Service
<img src="background.jpg" alt="Smiley face" height="200"
    width="900"></div>
<center>
  <p>&nbsp;</p>
  <p style="background-color: lightblue;"> <a href="http://localhost/food_menu_apps_system/index.php">Home</a>
    <a href="http://localhost/food_menu_apps_system/introduction.php">Introduction</a>
    <a href="http://localhost/food_menu_apps_system/sitemap.php">Site Map</a>
    <a href="http://localhost/food_menu_apps_system/job.php">Job
      Advertisement</a> <a href="http://localhost/food_menu_apps_system/history.php">History</a>
    <a href="http://localhost/food_menu_apps_system/location.php">Location</a>
    <a href="http://localhost/food_menu_apps_system/news.php">News</a> <a href="http://localhost/food_menu_apps_system/event.php">Event</a>
    <a href="http://localhost/food_menu_apps_system/feedback.html">Customer
      Feedback</a> </p>
  <h2 style="background-color: lightblue;"> Order Result</h2>
  <h2 style="background-color: lightblue;">
    <p style="background-color: lightblue;">
<?php $db_host = 'localhost'; $db_user = 'root'; $db_pwd = '123456'; $database = 'food_menu_apps_system'; $table = 'customer_process_order'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // sending query $result = mysql_query("SELECT * FROM {add_new_menu}"); if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); echo "

Table: {$table}

"; echo ""; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo ""; } echo "\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo ""; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo ""; echo "\n"; } mysql_free_result($result); ?>




{$field->name}
$cell




Copyright 2014-2015

[/php] vieworder.php [php]<?php //create short variable name $DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"]; ?> Food Menu and Ordering Service
<img src="background.jpg" alt="Smiley face" height="200"
    width="900"></div>
<center>
  <p>&nbsp;</p>
  <p style="background-color: lightblue;"> <a href="http://localhost/food_menu_apps_system/index.php">Home</a>
    <a href="http://localhost/food_menu_apps_system/introduction.php">Introduction</a>
    <a href="http://localhost/food_menu_apps_system/sitemap.php">Site Map</a>
    <a href="http://localhost/food_menu_apps_system/job.php">Job
      Advertisement</a> <a href="http://localhost/food_menu_apps_system/history.php">History</a>
    <a href="http://localhost/food_menu_apps_system/location.php">Location</a>
    <a href="http://localhost/food_menu_apps_system/news.php">News</a> <a href="http://localhost/food_menu_apps_system/event.php">Event</a>
    <a href="http://localhost/food_menu_apps_system/feedback.html">Customer
      Feedback</a> </p>
	  
	  <p>&nbsp;</p>
  Welcome, administration page.        <a href="http://localhost/food_menu_apps_system/logout.php">Logout</a>
  <p>
  
  <a href="http://localhost/food_menu_apps_system/connectivity.php">Admin Homepage</a>
  
  <a href="http://localhost/food_menu_apps_system/add_menu_table.php">Add menu to table</a> ||
      
	  <a href="http://localhost/food_menu_apps_system/vieworder.html">View Customer Order<br></a>||
	  
	  <a href="http://localhost/food_menu_apps_system/calculation.php">Order Calculation <br></a>||
     
	  
  
	  <p><p><p><p> View Customer Order<p><p><p><p>
	 
	  <table border=4>
<?php $db_host = 'localhost'; $db_user = 'root'; $db_pwd = '123456'; $database = 'food_menu_apps_system'; $table = 'customer_process_order'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // sending query $result = mysql_query("SELECT * FROM {customer_process_order}"); if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); echo "

Table: {$table}

"; echo ""; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo ""; } echo "\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo ""; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo ""; echo "\n"; } mysql_free_result($result); ?>[/php]
{$field->name}
$cell

Are you getting any errors?

Turn on your error checking if you don’t by
[php]ini_set(‘display_errors’,1);
error_reporting(E_ALL);[/php]

Plus I go through my usual routine, you’re using depreciated (soon to be obsolete) mysql, when you should be using mysqli or PDO. Whether you switch over or not is up to you. Though you will find people more eager to help you if you do, but I am sure old timers will be glad to help you out. :wink:

Well, you code confuses me a little, but, two things jump out at me right away.

First, your first file is a form that posts to the second file which is PHP code and a form.
But, in this second file, it run a query , “SELECT * FROM {add_new_menu}” But, I do not see where
the “add_new_menu” is pulled from.

Also, in this second file, it has a form which posts out to the third file which is listed as “vieworder.html”.
BUT, the name of the file is “vieworder.php”. So, it would never post to the correct file.

Lastly, the first file posts some entries to the second one, but, you never load these values or save them
anywhere. So, not really sure what these three files actually do. Not sure if this helps…

Sponsor our Newsletter | Privacy Policy | Terms of Service