Jump to content

$row entry to variable to form submission and retrieval


uncaringuser

Recommended Posts

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>

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.