Jump to content

function help


darkfreaks

Recommended Posts

Use an if statement to see if there is a value for sex and age

// sample data to work with
$data['name'] = 'Joe';
$data['sex'] = '';
$data['age'] = '';

     echo 'Name: ' . $data['name'] . '<br />';

     // Display the sex if its not empty
     if(!empty($data['name']))
     {
          echo 'Sex: '. $data['sex']  . '<br />';
     }

     // Display the age if its not empty
     if(!empty($data['age']))
     {
          echo 'Age: '. $data['age']  . '<br />';
     }

Link to comment
https://forums.phpfreaks.com/topic/240268-function-help/#findComment-1234435
Share on other sites

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.