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. Quote Link to comment 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']); Quote Link to comment Share on other sites More sharing options...
deshetty Posted July 9, 2010 Author Share Posted July 9, 2010 wow... thanks Joel..... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.