KeeganWolf Posted June 1, 2009 Share Posted June 1, 2009 I'm trying to list data in a table, and allow the user to modify and store the information. I have two files, one to create the form, and one to proccess it 'proc_print.php' . I'm kinda new at this, and I'm trying to figure out why it won't save the information to my mysql table. Here's what I have.. <?php // Make a MySQL Connection include_once "../scripts/connect_to_mysql.php"; // Create a page with the specified table info $store = "4071"; $local = "WF"; $query = "SELECT * FROM Inventory$store WHERE local='$local'"; echo "<table width=800 border=1 align=center><tr>"; echo "<td width=200><strong>Store: ", $store, "</strong></td>"; echo "<td width=584><strong>Step 1. Walk In Freezer</strong></td></tr></table><p><br /></p>"; $result = mysql_query($query) or die(mysql_error()); $content = <<<CONT <table border="1" align="center"> <tr> <th>Product ID</th> <th>Description</th> <th>Quantity</th> <th>Case</th> <th>Build2</th> </tr> CONT; while($row = mysql_fetch_array($result)){ $content .= <<<CON <tr> <td>{$row['fomez']}</td> <td>{$row['desc']}</td> <td><input type='text' name='quant' value='{$row['quant']}'></td> <td>{$row['quancase']}</td> <td><form method='post' action='proc_print.php'><input type='text' name='buil2' value='{$row['buil2']}'></td> </tr> CON; } $content .= "</table>"; echo $content; echo "<input type='submit' value='Continue to the next step.'></form>\n"; /// print_r($case); ?> And this file to process the information. [b]<?php // Make a MySQL Connection include_once "../scripts/connect_to_mysql.php"; $quant = $_REQUEST['quant']; $buil2 = $_REQUEST['buil2']; /***********************************************/ $case = addslashes($case); $case = htmlentities($case); $buil2 = addslashes($case); $buil2 = htmlentities($case); /***********************************************/ $deduct = "UPDATE Inventory4071 SET quant='$quant' WHERE fomez=fomez LIMIT 1"; $result = mysql_query($deduct); //if (mysql_query("UPDATE Inventory4071 SET quant='$quant' WHERE fomez=fomez LIMIT 1;")) { //echo "success"; //}else{ //echo "failed"; //} ?>[/b] Any ideas? ??? Link to comment https://forums.phpfreaks.com/topic/160525-storing-form-values-in-mysql-from-form-created-by-loop/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.