deshetty Posted July 9, 2010 Share Posted July 9, 2010 hello all, i have created a registration from where user will register by filling few personal details like name , phone no etc. i have not made the fields mandatory. now , while viewing the details of the users. if they have not entered any of the field its shows blank. say, if user has not provided the phone no its shows phone no:___________ . instead i want to display Phone no: Not Mentioned. could u please tel me what needs to be done. Link to comment https://forums.phpfreaks.com/topic/207222-issue-in-displaying-default-detiails-as-not-mentioned/ Share on other sites More sharing options...
joel24 Posted July 9, 2010 Share Posted July 9, 2010 You can edit the mysql table and set the default for the Phone No to "Not Mentioned", but then the field type would have to be varchar/text instead of integer. Another option is to write a simple function like function checkField($field) { if (empty($field)) { return "Not Mentioned"; } else { return $field; } } //now in the code when displaying SQL results echo checkField($row['phoneNumber']); Link to comment https://forums.phpfreaks.com/topic/207222-issue-in-displaying-default-detiails-as-not-mentioned/#findComment-1083439 Share on other sites More sharing options...
deshetty Posted July 9, 2010 Author Share Posted July 9, 2010 wow... thanks Joel..... Link to comment https://forums.phpfreaks.com/topic/207222-issue-in-displaying-default-detiails-as-not-mentioned/#findComment-1083510 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.