Originally posted by bubblenut
if(empty($_POST['field_name'])) {
$field_name='0.0';
} else {
$field_name=$_POST['field_name'];
}
//or even just
$field_name=empty($_POST['field_name'])?'0.0':$_POST['field_name'];
HTH
Bubble
<afterthought>It may be better to set a default value for the field in the table schema and then insert null for the field.</afterthought> [/B]
Hi Bubble,
The table schema does have a default value of 0.0 if u are referring to the database? Otherwise, you just gave me a brillant idea!!
The scenario is I have a form with 20textfields to be filled up by the user. How can I have all the text files to have a value of 0.0 which stays unless the user enters a new value otehrwise?
Cheers.