Jump to content

issue in displaying default detiails as Not Mentioned


deshetty

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.