Here is my script;
<?
include("./dbconnect.php");
print("<body bgcolor=\"#6699CC\">");
///////////////////////////////////////////////////////////////////////
//beginifedit
if($edit == 'EDIT')
{
$countnow = 0;
$totalcols1 = 3;
$colsprinted1 = 0;
$totalcolsprinted = 0;
$sumcolsprinted = 0;
print("<table border=\"0\" width=\"900\">");
while($countnow <= $totalitems)
{
$countnow++;
$item = ${'checkbox'.$countnow};
if($item != '')
{
if($colsprinted1 == $totalcols1)
{
print("</tr><tr>");
$colsprinted1 = 0;
}
$query0 = "select * from membres where id = '$item'";
$mysql_result0 = mysql_query($query0, $mysql_link);
while($row0 = mysql_fetch_row($mysql_result0))
{
echo "<form action=\"$PHP_SELF\" method=\"post\">";
printf("<td valign=\"top\"><h1>Editing:</h1></td><td valign=\"top\"
align=\"left\"><h1>%s, %s</h1>Prénom: <input type=\"text\"
name=\"editFirstName\" value=\"%s\"><br>Nom: <input
type=\"text\" name=\"editLastName\" value=\"%
s\"><br>Adresse: <input type=\"text\" name=\"editAddress\"
value=\"%s\"><br>Téléphone: <input type=\"text\"
name=\"editTelephone\" value=\"%s\"><br>Fréquence: <input
type=\"text\" name=\"editFrequency\" value=\"%s\"><br>Email:
<input type=\"text\" name=\"editEmail\" value=\"%s\">", $row0
[2], $row0[1], $row0[1], $row0[2], $row0[3], $row0[4], $row0
[5], $row0[6]);
echo "<input type=\"hidden\" name=\"ID\" value=\"$row0[0]\">";
echo "<input type=\"submit\" name=\"saveNow\" value=\"SAVE\">";
print("</td>");
echo "</form>";
}
$colsprinted1++;
$totalcolsprinted++;
$sumcolsprinted++;
}
}
}
if($saveNow == 'SAVE')
{
$query = "update membres set prenom = '$editFirstName', nom
= '$editLastName', adresse = '$editAddress', telephone
= '$editTelephone', frequency = '$editFrequency', email
= '$editEmail' where id = '$ID'";
$mysql_result = mysql_query($query, $mysql_link);
echo "<h1>Terminé l'opération modifié</h1>";
print("<form action = \"$PHP_SELF\" method=\"post\">");
print("<tr><td align=\"center\" colspan=\"4\"><input type=\"submit\" name=\"view\" value=\"LIST\"> ");
}
//endifedit
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
else{
print("<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\"><tr>");
print("<form action = \"$PHP_SELF\" method=\"post\">");
print("<input type=\"submit\" name=\"edit\" value=\"EDIT\"> ");
print("</td></tr>");
$count = 1;
$colsprinted = 0;
$totalcols = 3;
$totalitems = 0;
$query = "select * from membres order by nom";
$mysql_result = mysql_query($query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
if($colsprinted == $totalcols)
{
print("</tr><tr>");
$colsprinted = 0;
}
printf("<td valign=\"top\" style=\"border-bottom: solid 1 #000000
\"><input type=\"checkbox\" name=\"checkbox$count\"
value=\"%s\" unchecked>%s, %s<br>%s<br><b>Tel.:</b> %s
<b>Fréq.:</b> %s</td>", $row[0], $row[2], $row[1], $row[3],
$row[4], $row[5]);
$count++;
$colsprinted++;
$totalitems++;
}
printf("<input type=\"hidden\" name=\"totalitems\" value=\"%s\">", $totalitems);
print("</td></tr>");
print("</form>");
print("</table>");
}
////////////////////////////////////////////////////////////////////////
?>
When I first access the script, all is good. ei: all the records show
up and my edit button is on top left.
Although, when I select a record (checkbox) and click the edit
button, I get the edit form with the save button, but also get the
edit button again bellow the edit form and all the records show
up bellow also!
How can I make it so that when I click the edit button, ONLY the
edit form and the save button show up?