I have a form that allows users to update their client's transactions. This form comes populated with the information already listed for the transaction. I want to have a drop down list for the customer names so that they have to choose an existing customer.
My problem is that the sql to populate the answers with the existing information conflicts with the sql to bring up the customer names in the database.
Is there a way to do this? Here is the code I have that brings up the populated answers:
<table>
<?php
if (!isset ($p_submitval))
{
$sql = "SELECT crid, c.custid,
firstname, lastname, cramount, crdate
FROM databau7_thomand.customer
c inner join databau7_thomand.cashrec r on
c.custid = r.custid WHERE crid= " .
$p_crid;
$result = mysqli_query($con, $sql);
while($row =
mysqli_fetch_array($result))
echo "<h2>Update Customer
Information</h2>\n";
echo "<p><i>Please update the customer information.</i><br>\n";
echo "<form action=\"web4_transactioninput.php\" method=post>\n";
echo "<input type=\"hidden\" name=\"crid\" value = \"$p_crid\">\n";
echo "<table border=\"3\"> \n";
echo "<td align=\"right\"><b>Customer Name:
</td>";
echo "<td><select name=\"custid\"
class=\"dropdown\">";
echo "<option value=\"0\" selected>
".$row['firstname']." ".$row['lastname']."
</option>\"";
echo "<tr>\n<td align=\"right\">\n";
echo "<b>Amount:</b>\n";
echo "</td>\n<td>\n";
echo "<input type=\"text\"
name=\"cramount\"size=\"30\"
value=\"".$row['cramount']."\">\n";
echo "</td>\n</tr>\n";echo "<tr>\n<td
align=\"right\">\n";
echo "<b>Date:</b>\n";
echo "</td>\n<td>\n";
echo "<input type=\"date\"
name=\"crdate\"size=\"30\"
value=\"".$row['crdate']."\">\n";
echo "</td>\n</tr>\n";echo "<tr>\n<td
align=\"right\">\n";
}
while($row =
mysqli_fetch_array($result))
echo "</select>\n</td>\n</tr>\n";
echo "</table>\n";
Thank you for the help!