Hi Mike;
I had the same issue when writing
to a file as opposed to a DB.
I did 2 things to remedy the problem.
(try the 2nd one first, it makes more sense)
First, i made the form reset itself
every time info is sent.
(do this first thing in the doc,
or after the header if you wish).
so, if there was some data buffered in,
it would be cleared out.
i accomplished this with a bit of JavaScript,
which basically took the form of an onClick handler in the <input type="submit" onClick="cleerit(); return true;">
(Note: make sure you put in a time delay
of a few milliseconds, or it will
immediately clear your form and not
send the data at all.
Your function be something like this.
(i forget the exact JavaSCript).
-- about.com has an excellent section on JavaScript even though they have too many banner pop-ups)
function cleerit() {
setTimeout('function()', milliseconds);
//code to clear form,usually
document.form[name of form].reset;
}
But the 2nd step really helped.
on your submit form, make sure the
<input type="submit"> tag has a name
attribute to it,
that way, it becomes a known
variable at the target action script page.
Hence, if you use this tag
<input type="submit" name="sendit" vale="submit info">
in the FORM block , then, in the action
page that runs the script to process your
entry, you can refer to the variable
that was initiated as a result of clicking
the button "submit info".
This variable is known as $sendit.
u can set your script so that
it will only write to the db if
the variable $sendit has been set.
meaning, if the form submit button
from previous page was not clicked,
then no writing action will occur.
You can try this;
if (!isset ($sendit)) {
// do not write to db, the submit button
// was not clicked.
}
else {
// we can write to db, the submit button was
//clicked, and $sendit has been initialised !
code to execute your writing to db
}
I hope this helps.
Again, please try the 2nd approach,
and if it helps,
then apply the JavaScript mentioned
in step 1.
In fact, the JavaScript might not
even be necessary, but for me,
its a cool add-on, so that the user
will not have to delete a previous
entry to send info at another time.
-- And;
While JavaScript is cool,
it is an extreme nightmare to debug
while using IE browsers.
and, yes, 1 little syntax error can
make you change code that was fine
to begin with.
I strongly recommend about.com,
they have a good grasp at proper
javascript code writing.
They just need to calm down
with all the pop ups that they send.
later;
Adam