I have a bit of a problem here. When I insert a form into MySQL and report back a tracking number(the auto_increment ID field) it exactly what I want.
However, if I hit reload or open new window, it double stores the article. How can I prevent this from happening? I was thinking a gigantic AND set of statements for all the variables to make sure they do not exist in the same combination, but a cleaner way would be nicer:
/ make connection to database /
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to data
base");
@mysql_select_db( "$dbName") or die( "Unable to select database");
/ Insert the incident report into table IncidentReport, database DOC-CIRT/
$query = "INSERT INTO $userstable
VALUES (NULL,'$datemonth','$dateday','$dateyear','$timehour','$timeminutes','$timecycle','$name','$organization','$e
mail','$phone','$fax','$location','$ip1','$ip2','$ip3','$ip4','$ip5','$ip6','$ipsource1','$ipsource2','$ipsource3','
$ipsource4','$ipsource5','$ipsource6','$os','$function','$function2')";
#PRINT $query;
$result = MYSQL_QUERY($query);
$trackin = mysql_insert_id();
PRINT "<BODY text=blue><center><P><font size=2><h1>Incident Report Stored<h1></font><p>
The tracking number for your report is </font><BR>
<font size=9 color=red>DOC-CIRT-IR- $trackin - $dateyear</font><P>
Please refer to this number in all future references to your incident";
mail("dzubairi@doc.gov", "XXXXXXX Incident $trackin - $dateyear", "An Incident has been reported to the XXXXXXX Au
tomated Incident Center\n\n The tracking ID for this incident is XXXXXXXXXX$trackin - $dateyear");
/ Close the database connection /
MYSQL_CLOSE();