mercredi 1 mai 2019

Email always takes the if and not the else if/ else

I have a function in my website where you can buy stuff. After you did that you will get an email. Everything works fine except 1 thing. I have an if-statement in my but it always takes the if and not the else if or the else.

I searched on the internet but I couldn't find any solution. I tried in my else if different things like else if(isset empty($registrationInfo['serviceselectoptie']) and else if(isset ($registrationInfo['serviceselectoptie'] === NULL) but that didn't work.

My If-statement

<?php

$registrationInfo = $connect->select("SELECT * FROM `registrationinfo` WHERE `orderId`= '".$order_id."' LIMIT 1")->fetch();

if(isset($registrationInfo['serviceselectoptie']) AND isset($registrationInfo['serviceconsult'])) 
  { $titellist = '<tr><td bgcolor="#DEDEDE" style="padding: 5px 5px 5px 5px;width:175px;">
  ' .$registrationInfo['serviceselectoptie'].':
    </td><td style="padding: 5px 5px 5px 5px;">'.$registrationInfo['serviceconsult'].
  '</td></tr>'; } 
else if(!isset($registrationInfo['serviceselectoptie']) AND isset($registrationInfo['serviceconsult'])) {
 $titellist = '<tr><td bgcolor="#DEDEDE" style="padding: 5px 5px 5px 5px;width:175px;">
 Bestelling:</td><td style="padding: 5px 5px 5px 5px;">'.$registrationInfo['serviceconsult'].'</td></tr>';
} 
else { $titellist = ""; }
?>

What I expect is that if $registrationInfo['serviceselectoptie'] row is empty (null) that it will go to the else if. But my actual output is that it takes the if statement and because the row is empty it will just give :

Example of output

enter image description here

Aucun commentaire:

Enregistrer un commentaire