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.

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']);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.