I have another page where I am displaying the entries in a service record of an individual and in another form on the same page you can add an entry into the service record.
I pass an id into the page so I get the proper service record of the member, but it also adds a record when I enter the page not when I click on add.
// Add a Service Record to a Member
echo "<form>";
echo "<form action=\"$_SERVER ['PHP_SELF']\" method=\"POST\">";
echo "<table border=\"2\" cellpadding=\"2\" align =\"center\" cellspacing=\"0\" style=\"border-collapse: collapse\" bgcolor=\"#000000\" bordercolor=\"#111111\" width=\"100%\"><tr>"
. " <td align=\"center\" bgcolor=\"#777777\">"
. " <b><font color=\"#000000\">Add an entry into a Service Record</font></b>"
. " </td>"
. " <tr>"
. " <td align=\"left\" bgcolor=\"#666633\">"
. " <b><font color=\"#000000\">Personnel File</font></b>"
. " </td>"
. " </tr>";
echo "<table border=0 width='100%' cellpadding='3'><tr><th width='8%'>Record Date</th><th width='30%'><b>Record Details</b></th></tr>";
echo " <tr>";
echo " <td align=\"center\" bgcolor=\"#999999\">";
echo " <input type=\"text\" align=\"center\" name=\"record_dt\">";
echo " </td>";
echo " <td align=\"left\" bgcolor=\"#999999\">";
echo " <input type=\"text\" size=\"100\" maxlength=\"100\" align=\"center\" name=\"details\">";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<br>";
echo " <input type=\"submit\" align=\"center\" name=\"Submit\" value=\"Add\"/>";
if (isset($POST["record_dt"]));
//A new record has been added
$rec_dt = $_POST["record_dt"];
$rec_details = $_POST["details"];
$id = $_GET['id'];
$sql = "INSERT INTO service_record SET record_dt='$rec_dt', details='$rec_details', uniqueid='$id'";
if (@mysql_query($sql)) {
echo "<P> New Service Record Added!</P>";
}
echo "</form>";
I need this to work only when I click on add. Right now records are being added as soon as the page is displayed.