Well, if the query is not wrapped in some type of container (a function, an if statement, a loop), then it will always execute.
If you just have
<?php
# code for inserting here
?>
Then everytime you go to that page, it will insert a record. Obviously, if there are no variables to insert into the database, then you will get a black record.
However, if you wrap your insertion code into a function and then call the function like so, that may work:
<?php
function insert($data) {
$sql = "INSERT INTO ....";
// continue with code
}
Then call function like so:
insert($textbox);
It will do the function and everything should be fine and dandy.
You should also check to see if the variable you are inserting has a value, and if not, don't insert it:
if(!isset($textbox)) {
// dont query the value into the db
} else {
// do query the value into the db
}
I think that should do it. If it keeps doing that, I don't know what you say. Perhaps post the site that it is happening at or email me all of the code at krs-one@cnunited.com and I will take a look at it.
Hope this helps.
-Vic
vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====