如果表中的语句PHP

我创建了一个表,当我尝试在我的表中使用if语句时,一切正常。我不太确定如何解决尝试了一些研究但无法找到答案的问题。回显一个对象本身是可行的,但是如果由于某种原因而存在一个语句或某种条件,表将不喜欢它。


if(!mysqli_query($dbConn,$sql))

 {

echo 'Not Inserted';

}


else {

   echo "

   <table class='table'>

   <tr>

   <th>Name:</th>

   <th>$forename</th>

   </tr>


   <tr>

   <th>Surname:</th>

   <th>$surname</th>

   </tr>


   <tr>

   <th>Your email:</th>

   <th>$email</th>

   </tr>


   <tr>

   <th>Your Landline number:</th>

   <th>$landLineTelNo</th>

   </tr>


   <tr>

   <th>Your Mobile number:</th>

   <th>$mobileTelNo</th>

   </tr>


   <tr>

   <th>Your address:</th>

   <th>join(', ',$Address)</th>   <----------- issue

   </tr>


   <tr>

   <th>Your preferred method of contact:</th>

   <th>$sendMethod</th>

   </tr>



   <tr>

   <th>Your category chosen:</th>

   <th>

   if($catID == \"c1\"){             <------------  issue

       echo \"Bed and Breakfast\";

   }

   elseif ($catID == \"c2\"){

       echo \"Craft Shop\";

   }

   elseif ($catID == \"c3\"){

       echo \"Post Office\";

   }

   elseif ($catID == \"c4\"){

       echo \"Tearoom\";

   }

   elseif ($catID == \"c5\"){

       echo \"Village Store\";

   }

   elseif ($catID == \"null\"){

       echo \"No Category chosen\";               

   }                                 <------------  issue



   </th>

   </tr>


   ";

谢谢


绝地无双
浏览 135回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP