vendredi 10 avril 2015

PHP IF - ELSE - ELSE


<html>
<input type='text' name='mobile phone' value='
<?php if (strpos($phone_number, '07') === 0) {
echo $phone_number;
} else {
echo $alt_phone;
}?>'


Works fine. I would like to combine the above with:-



<?php if (!empty($alt_phone)) {
echo $alt_phone;
} else {
echo '07777777777';
}?>'`


I have tried ELSEIF with the new condition, and a completely separate section and both times I get a blank page, instead of a textbox with a telephone number in it.


I am trying to check if $phone_number is a mobile, enter this number, otherwise enter the alt_phone, unless $alt_phone is blank, then enter 07777777777


Aucun commentaire:

Enregistrer un commentaire