Forum Moderators: coopster
I have a html form that is validated through javascript. If all the info is entered, the values get inserted into a MySQL table via a PHP command. Problem is.. it seems to randomly insert blank rows. it's only happened a handful of times.. but it stalls a subsequent script that later pulls that info out of the MySQL table.
I cannot seem to determine how or why. seeing that the form cannot go through without all the fields on the form being filled.. i'm not quite sure an occasional blank row is getting in.
would the solution be to write a PHP function to double check the validation of those fields?
any help is greatly appreciated!
the PHP code is below:
$linkId = @mysql_connect("localhost", "name", "password");
mysql_select_db("name", $linkId);
mysql_query("INSERT INTO _table (ID, FirstName, Email) VALUES (NULL, '$x_first_name, '$x_email')", $linkId);
-Bess
Yes. Right now, you're doing it on the client side. They can choose to ignore your validation (i.e. disable JavaScript), or it could be a bot, like Googlebot, that doesn't support JavaScript.
You have to validate server-side to avoid this.