Hello, I need help with retrieving form data from a mysql database-table. Now, I have scripted so that the data is listed in a table(below).
click to see primary page
When I click "Click Here" I want to see the details of that form etc. And I am successful. But when I select on the 2nd available form it displays the same data as the first form.
Code for the first page.
<?php
include_once("config.php");
$result = mysql_query("SELECT * FROM ap_form_1 ORDER BY id ASC") or die(mysql_error());
echo "<table border='3'>";
echo "<tr> <th>#</th> <th>Date Submitted</th> <th>Applicant's Name</th> <th>Process Application</th> <th>Status</th></tr>";
// Retrieves all available rows until no more to get
while($row = mysql_fetch_array($result))
{
//The content of each row are printed into the table
echo "<tr><td>";
echo "<form method='POST' name='id'>".$row['id']."</font>";
echo "</td><td>";
echo $row['date_created'];
echo "</td><td>";
echo "<center>".$row['element_1']."</center>";
echo "</td><td>";
echo "<center><a href='http://www.dfl.xtreemhost.com/admins/view/licenses/firearm/gov/result/index.php'>Click Here</a></center>";
echo "</td><td>";
echo "<font color='red'>Not Processed</font></td>";
echo "</tr>";
}
echo "</table>";
?>
Code for the page which is supposed to show all form data / details
<?php
include_once("config.php");
$result = mysql_query("SELECT * FROM ap_form_1 ORDER BY id") or die(mysql_error());
$info = mysql_fetch_array($result);
while($row = mysql_fetch_array($result))
{
echo "<h3>".$info['element_1']."'s License Application</h3><br /><center><hr><br /><br />";
echo "<tr><th><div align='left'><strong><font type='Verdana'>Date Application Posted:</strong></th></tr><tr><td> ".$info['date_created']."</td></tr> </div>";
echo "<h2><u>Personal Information</u></h2>";
echo "<h3>Applicant's Name</h3>" .$info['element_1']. "";
echo "<h3>Date of Birth</h3>" .$info['element_2']. "";
echo "<h3>Sex /Gender</h3>";
if($info['element_16']==1)
{
echo "Male";
}
else
echo "Female";
echo "<h3>Race</h3>";
if($info['element_17']==1)
{
echo "Black";
}
elseif($info['element_17']==2)
{
echo "White";
}
elseif($info['element_17']==3)
{
echo "Latino";
}
elseif($info['element_17']==4)
{
echo "Middle Eastern";
}
elseif($info['element_17']==5)
{
echo "Asian";
}
else
echo $info['element_12'];
echo "<h3>Phone Number</h3>" .$info['element_3']. "";
echo "<h3>Home Address</h3>" .$info['element_4']. "";
echo "<h3>Occupation</h3>" .$info['element_5']. "";
echo "<h2><u>Firearm Information</u></h2>";
echo "<h3>Desired Firearm License and Type</h3>";
if($info['element_20']==1)
{
echo "4 1/2 Blade";
}
elseif($info['element_20']==2)
{
echo ".45 Caliber";
}
else//if ($info['element_20']==3)
echo ".50 Caliber";
echo "<h3>Reason for Obtaining a Firearm License</h3><p><textarea cols='80' rows='6' disabled='true'>" .$info['element_9']. "</textarea></p>";
echo "<h3>Where will your Firearm License be Stored</h3><form><textarea cols='80' rows='6' disabled='true'>".$info['element_10']. "</textarea></p>";
echo "<h2><u>Background Information</u></h2>";
echo "<h3>Have you ever had a license</h3>";
if($info['element_18']==1)
{
echo "Yes";
}
else
echo "No";
Print "<h3>Has your license ever been removed</h3>";
if($info['element_19']==1)
{
echo "Yes";
}
else
echo "No";
echo "<h2><u>(( OOC Information ))</u></h2>";
echo "<h3>Are you at least level 4 in-game</h3>";
if($info['element_21']==1)
{
echo "Yes";
}
else
echo "No";
$e8 = $info['element_8'];
echo "<h3>LS-RP Forum Account Link</h3><a href='$e8'>Click Here</a>";
echo "<h3>Have you read and understood the EULA</h3>";
if($info['element_21']==1)
{
echo "Yes";
}
else
echo "No";
echo "<h3>Signature</h3><p>I, <u><i>" .$info['element_15']. "</u></u>, hereby declare that I understand and agree to the rules and conducts mentioned in the EULA, this includes the understanding of the consequences I may face if those terms are to be broken. I also understand that there is no verbal or inscribed authentication or proof of my acceptance of this conduct. This enables me to know that all personnel in the respected firms, bearing the above firearms are subject to prosecution and removal of your license (justified or unjustified) if these regulations are to be violated.<br /><br />";
}
?>
I need help on displaying the form data that belongs to each application.