Connecting Tech Pros Worldwide Help | Site Map

"Column 'Name' cannot be null"

  #1  
Old July 17th, 2005, 09:40 AM
hjyn
Guest
 
Posts: n/a
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
  #2  
Old July 17th, 2005, 09:40 AM
Christopher-Robin
Guest
 
Posts: n/a

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)** ){
**ADD DATA TO DATABASE**
}else{
**PROMT USER TO ENTER DATA CORRECTLY**
**RE-ECHO THE FORM WITH PRE-ENTERED DATA**
}

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.


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking if a DataRow is "empty" mcbobin answers 10 November 1st, 2006 11:05 PM
"error_reporting" setting not being recognized in my php.ini file laredotornado@zipmail.com answers 1 October 3rd, 2006 03:25 PM
Help with special values (Null, Empty, "", etc) Lyn answers 8 November 13th, 2005 07:06 AM
Concurrency issues with "Tree" structures. Robin Tucker answers 4 July 23rd, 2005 09:19 AM