uncaringuser Posted May 17, 2012 Share Posted May 17, 2012 Hi, Im at a standstill. I have a MYSQL database which has a name and amount field that automatically generates a random number when the details get uploaded via form and submitted. The information is then displayed on another and the values generated are assigned to the <name> parameter in the form so that each field generated has a unique value, you with me so far? So to confirm I have a form that the user fills out and it has two hidden fields that are automatically given random values when submitted to the database. This is then retrieved on another page and the random values are assigned to the name value in another form. I want the user to fill out this form and have each value submitted to another page and shown. I shall post my code and if anyone could help me with this issue I would be most grateful. Thank you! Form in which the data from the database is assigned to the name tag: <form method="post" action="step4.php"> <table class="food"> <?php $con = mysql_connect("database details"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("catering", $con); $result= mysql_query("SELECT * FROM starters WHERE category='meat'"); while($row = mysql_fetch_array($result)) { echo"<tr>"; echo"<td>"; echo"<p class=\"form2\">"; echo $row["title"]; echo " - £"; echo $row["price"]; echo"<br>"; echo"<span class=\"subtext\">". $row['subtext'] . "</span>"; echo"</p>"; echo"</td>"; echo"<td class=\"addon\">"; echo"<input type=\"checkbox\" class=\"largecheckbox\" name=". $row['nameid'] .">"; echo"</td>"; echo"<td class=\"addon\">"; echo"<input type=\"text\" class=\"amount\" name=". $row['amountid'] .">"; echo"</td>"; echo"</tr>"; } echo ""; mysql_close($con); ?> </table> </div> <div id="bottom"> <div id="build"></div> <div id="backbutt"><a href="step2.html"><img src="./images/prevbutt.png"></a></div> <div id="nextbutt"><input type="image" src="./images/nextbutt.png"></div> </form> </div> </div> <div id="footer"> <p class="footer">Mistrys Catering | 01204 527 139 | info@mistryscatering.com</p> </div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
smoseley Posted May 17, 2012 Share Posted May 17, 2012 What's the question? Quote Link to comment Share on other sites More sharing options...
uncaringuser Posted May 17, 2012 Author Share Posted May 17, 2012 How would I go about taking the values randomly generated and get them to be an actual name value, so that the information typed into the form can be passed properly from one form to the next, I have tried variables and sessions and im getting no errors, but nothing displays results wise, so I dont know what im doing wrong. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.