this have been posted on other forums but I've not been able to get a workable answer. Any help GREATLY APPRECIATED.
This is a two part problem associated with setting table data types and echoing text labels, along with the values.
The labels appear beside these values when written onto the page). They should appear only when there is a real value in the column entered by the user, otherwise they don't appear on the page.
Although the problem seems basic, here are some notes with why I haven't been able to do this:
Value types have been set to either 'varchar' or 'integers'.
Even though setting code to NOT NULL with default of '0' works for echoing my code back:
FOR LABELS:
<?php if (!empty($row_Ret['JContPhone'])){echo '<font size="2" face="Arial
Narrow">phone</font>';}
?>
FOR VALUES:
<?php if (!empty($row_Ret['JContPhone'])){echo $row_Ret['JContPhone']; }
?>
When I set the table NOT NULL with default of even '0' on column to make this work, which seems necessary: the error is kicking back "cannot be null" on the INSERT form field when left empty. Same for NOT NULL set to 'none' - same error messge "cannot be null". Basically I'll get an error message if I set to NOT NULL with any default value as long as the field is left empty on INSERT form.
Actually setting to '0' presents other problems (echoing back for control panel forms, repeat users) so I'll have to forget '0' but maybe the above could help...
A default value like "none": which would work for these other reasons ( again, echoing back for control panel forms, repeat users)
-However if I want to have this auto-inserted by mysql I'll have to set to a NULL value. But I've run into a snag with this since !NULL just doesn't work (as opposed to !empty above, or any !NULL has problems, also for '&&' ): see http://www.php.net/manual/en/language.types.null.php
[I]Other:[/I]
'is_numeric' is out due to special characters (brackets/hypens/phone extensions)
'preg_match' is out due to special characters too
These may have possibly worked for certain values but I think what I really need is way to either use NULL values in tables with defaults, to accomodate the forms. Or something else altogether.
What does everybody use in the php world when they when to echo values and have text labels for values only when values entered by the user exist?
-Would very much appreciate any help on this.