Quote:
|
Originally Posted by delerium
ok, heres my script:
$result = mysql_query("SELECT * FROM orderrequestform",$db) ;printf(mysql_error());
if ($myrow = mysql_fetch_array($result))
{
echo "<table cellpadding=0 cellspacing=0 border=1>\n";
printf("<tr><td><a>check box form under here</a><br></td>
<td><a>first name</a><br></td>
<td><a>last name</a><br></td>
<td><a>school</a><br></td>
<td><a>Street Address</a><br></td>
<td><a>City</a><br></td>
<td><a>State</a><br></td>
<td><a>Zip</a><br></td>
<td><a>Phone Number</a><br></td>
<td><a>Email Address</a><br></td>
</tr>\n",
$PHP_SELF, $myrow["FName"],$PHP_SELF, $myrow["LName"],
$PHP_SELF, $myrow["School"],$PHP_SELF, $myrow["SAddress"],
$PHP_SELF, $myrow["City"],$PHP_SELF, $myrow["State"],
$PHP_SELF, $myrow["Zip"],$PHP_SELF, $myrow["PhoneNum"],
$PHP_SELF, $myrow["Email"]);
do {
//this populates the table
printf("<tr><td>i want a check box here</td><td>%s</td><td>%s</td>
<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</tr>\n",
$myrow["FName"],
$myrow["LName"],$myrow["School"], $myrow["SAddress"] ,$myrow["City"]
, $myrow["State"], $myrow["Zip"], $myrow["PhoneNum"], $myrow["Email"]);
} while ($myrow = mysql_fetch_array($result));
as you can see, what im doing is creating a table that will be filled with everything in my data base. simple enough i guess. what i need to do now is have a check box form included with each row of the table (i marked the space in the table). problem is, when i try to include the form i get errors saying unexpected T-String. the code i have in the cell space is "<input type="checkbox" name="a" value="a">" any suggestions on what im doing wrong and what i could do to fix it?
|
I'm no PHP expert but what I did in this same kinda setup is:
<?
//put all html into a php variable
$table_code="<p align=\"center\"><img src=\"images/braggdisclogo1.gif\" width=\"540\" height=\"150\"><br><p align=\"center\"><font size=\"2\"><b>Bragg Clients</b>\n<br>".date("F d, Y")."</font></p>\n
<table width=\"749\" border=\"1\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">\n
<tr>\n
<td width=\"69\"><input type=\"submit\" name=\"Submit\" value=\"Query\"></td>\n
<td width=\"126\"><input type=\"radio\" name=\"client_query\" value=\"4\">Order By Date</td>\n
<td width=\"205\"><input type=\"radio\" name=\"client_query\" value=\"3\">Alphabetical By Last Name</td>\n
<td width=\"143\"><input type=\"radio\" name=\"client_query\" value=\"5\"> View Downlines</td>\n
<td width=\"143\"><input type=\"radio\" name=\"client_query\" value=\"1\"> Query All Clients</td>\n
</tr>\n";
echo"$table_code";
while ($row=mysql_fetch_array($result))
{
echo "<font size=\"2\"> &nb sp; </font>";
echo "<table width=\"749\" border=\"1\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">\n";
echo "<tr align=\"center\" valign=\"top\" bgcolor=\"#C7D1E6\">\n";
echo " <td width=\"46\"><font size=\"2\"><b><input type=\"checkbox\" name=\"delete_box\" value=",($row['id']),"><br>delete?</font></b></td>\n";
echo " <td width=\"78\"><font size=\"2\">First Name: <br><b>".($row['first_name'])."</font></b></td>\n";
echo " <td width=\"75\"><font size=\"2\">Last Name: <br><b>".($row['last_name'])."</font></b></td>\n";
echo " <td width=\"233\"><font size=\"2\" color=\"#000000\">Email: <br><b><a href=\"mailto:".($row['email'])."\">".($row['email'])." </a> </font></b></td>\n";
echo " <td width=\"64\"><font size=\"2\">Phone: <br><b>".($row['phone'])."</font></b></td>\n";
echo " <td width=\"65\"><font size=\"2\">Product: <br><b>".($row['product'])."</font></b></td>\n";
echo " <td width=\"94\"><font size=\"2\">Access Code:<br> <b>".($row['access_code'])."</font></b></td>\n";
echo " <td width=\"60\"><font size=\"2\">Date: <br><b>".($row['date'])."</font></b></td>\n";
echo "</tr>\n";
}
?>
That will put a check box at the end of every row, and the row id will be it's value.
Let me know if that help at all.