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