-2
我有一個表單,完成後存儲您的fbid。我想用if-else來檢查這個人是否填寫了表格。爲了做到這一點,我匹配了ID。但是,if-else語句不起作用。IF ELSE語句php
這是的if-else:
<?php
$con = mysql_connect("localhost","fbappsadmin","[email protected]");
mysql_select_db("jetstardatabase", $con);
if($me)
{
$fbid= $facebook->api('/me');
$fbme = $fbid['id'];
$fbName = $fbid['name'] ;
$fbEmail = $fbid['email'];
$sql = "SELECT fbId FROM orders";
$result = $mysqli->query($sql);
while (list($fb)=$result->fetch_row())
{
if ($fbme ==$fb)
{
?>
<label id ="quantity" >Quantity</label>
<div class = "form">
<form action="" method="post" style="visibility:hidden" >
<select name="list" id="list">
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" name="submit" id="submit" value="Buy!" />
</form>
</div>
<?php
}
else
{
?>
<label id ="quantity" >Quantity</label>
<div class = "form">
<form action="" method="post" >
<select name="list" id="list">
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" name="submit" id="submit" value="Buy!" />
</form>
</div>
<?php
}
}}?>
首先,解釋if-else語句不起作用。其次,用正確的縮進格式化你的代碼,以便閱讀和理解。謝謝。 – ken 2012-01-09 15:14:08
「if-else語句不起作用」是什麼意思? '$ fbme == $ fb'是'true'或者'false'。 – 2012-01-09 15:18:29