sneakyimp wrote:I'm not sure what you're after exactly but it sounds like you can retrieve data from your database satisfactorily and you are displaying it in a form. The problem is when the form gets submitted you don't know where to find your data.
That could be because there are no <FORM></FORM> tags on your page. There is also no closing TABLE tag nor a submit button.
If that's not what you mean then you should take another stab at describing what your problem is because I'm not really sure at all.
Your assessment is correct. Once the form is submitted I cannot get the data. I do have a form with submit and also a closing table tag.
<html>
<body>
<?php
$db = mysql_connect("localhost", "root","pass1");
mysql_select_db("citrus_fundraiser",$db);
echo "<table border=1>\n";
//If you have received a submission.
if ($_POST['mysubmit'] == "Submit"){
$phone = $_POST['phone_a'];
echo "First phone number = ".$phone[0]."<br>";
echo "Third phone number = ".$phone[2]."<br>";
}
// show customer list
$result = mysql_query("SELECT FROM customers",$db);
$result2 = mysql_query("SELECT FROM prices",$db);
if ($myrow = mysql_fetch_array($result)) {
$myrow2 = mysql_fetch_array($result2);
// display list if there are records to display
echo "<tr><td><b>Customer</b></td><td><b>Telephone</b></td><td><b>Oranges</b></td><td><b>Grapefruits</b></td><td><b>Tangerines</b></td><td><b>Variety</b></td><td><b>\$Order</b></td><td><b>\$Paid</b></td><td><b>\$Owing</b></td><td><b>Picked Up</b></td><td><b>Comments</b></td><br>\n";
$i = 0;
do {
//Set customer name
$cn[$i] = sprintf("%s %s",$myrow["firstname"],$myrow["lastname"]);
$phone[$i] = $myrow["phone"];
$ordered[$i] = ($myrow["citrus1"]$myrow2["citrus1_price"])+($myrow["citrus2"]$myrow2["citrus2_price"])+($myrow["citrus3"]$myrow2["citrus3_price"])+($myrow["citrus4"]$myrow2["citrus4_price"]);
$paid[$i] = $myrow["paid"];
$owing[$i] = $ordered - $myrow["paid"];
$citrus1[$i] = $myrow["citrus1"];
$citrus2[$i] = $myrow["citrus2"];
$citrus3[$i] = $myrow["citrus3"];
$citrus4[$i] = $myrow["citrus4"];
$pickedup[$i] = $myrow["pickedup"];
$comments[$i] = $myrow["comments"];
$total_order[$i] = $citrus1[$i] + $citrus2[$i] + $citrus3[$i] + $citrus4[$i];
printf("<tr bgcolor='red'><td><input type=\"text\" name=\"cn_a[]\" value=\"%s\"></td>", $cn[$i]);
printf("<td><input type =\"text\" size =\"12\" name=\"phone_a[]\" value=\"%s\"></td>", $phone[$i]);
printf("<td><input type =\"text\" size =\"6\" name=\"citrus1_a[]\" value=%u></td>", $citrus1[$i]);
printf("<td><input type =\"text\" size =\"11\" name=\"citrus2_a[]\" value=%u></td>", $citrus2[$i]);
printf("<td><input type =\"text\" size =\"10\" name=\"citrus3_a[]\" value=%u></td>", $citrus3[$i]);
printf("<td><input type =\"text\" size =\"7\" name=\"citrus4_a[]\" value=%u></td>", $citrus4[$i]);
printf("<td>%01.2f</td>", $ordered[$i]);
printf("<td><input type =\"text\" size=\"5\" name=\"paid_a[]\" value=%01.2f></td>", $paid[$i]);
printf("<td>%01.2f</td>", $owing[$i]);
printf("<td><input type =\"text\" size=\"9\" name=\"pickedup_a[]\" value=\"%u\"></td>", $pickedup[$i]);
printf("<td><input type =\"text\" size=\"25\" name=\"comments_a[]\" value=\"%s\"></td></tr><br>\n", $comments[$i]);
$i++;
} while ($myrow = mysql_fetch_array($result));
}
echo "</table>\n";
?>
<form action="cf2.php3" method="POST">
<input type="submit" name="mysubmit" value="Submit">
</form>
</body>
</html>