"Column 'Name' cannot be null"

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi All, I create a form for the user to enter the information, the
form contains two table, table A and table B. I wrote a script to
prompt the user to fill all the necessary data if they miss to fill in
one column. The problem I met now is once I fill the data of first
table and leave the second data blank, an error occured to prompt the
user to fill the second table and return to main page again, after I
clicked ok and error message displayed "Column 'Name' cannot be null"
and the information I entered previously was stored into the database.
If I key in the information again, the data is duplicate in the
database. How to avoid that? Thanks

Best Regards,
Hau Jyn

Re: "Column 'Name' cannot be null"

Here's a hint: don't ever add data to a data-base, when its not absolutly
correct/complete, because there's no ensurence, that the user will add the
missing data.

if( **ALL DATA INPUT CORRECT (nothing is blank)** ){

This should work correctly, without doublicated data.

To avoid that the user has to re-enter data, that has already been entered
once, you could use the $_REQUEST variables and the VALUE properties of
<input ...> and <textarea>...</textarea> (whatever).

It's been used like this:

echo '<input type="text" name="D_NAME" value="'.$_REQUEST["D_NAME"].'">';
echo '<textarea name="D_TEXT">'.$_REQUEST["D_TEXT"].'</textarea>';
  // D_NAME and D_TEXT could be anything (must be a valid name).

So, when the user forgets to enter some data, he will be asked to fill out
the form again, BUT the data he/she previously entered will be in the form,
already, so he/she only has to add the data he/she forgot.

Site Timeline