What do you mean by
if my contents of form is set with mysql database
? I don't get that condition.
But anyway, you can have the form submit to a PHP script, the PHP script will check, and if it satisfies the condition, do something. If it doesn't satisfy the condition, re-output the form.
Diego