Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 17th, 2005, 09:40 AM
hjyn
Guest
 
Posts: n/a
Default "Column 'Name' cannot be null"

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
Default 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.


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles