别的还是其他? [英] else or elseif?
问题描述
我正在尝试获取防错代码。
我有这个代码似乎有用但现在我看着它我认为它
应该是elseif不是,我想知道为什么它的工作原理。它位于
区块:
if($ _ POST(''assign''] =''在Excel中打开'')] ... {
} elseif($ _ POST [''assign''] ==''在Excel中打开'')] ...
?
shouldn'不是别的吗?
或应该是
如果....
elseif ... ..
其他
($ _POST [''redirect'']&& $ _ POST [''redirect''}!= $ _ SERVER [''PHP_SELF ''}){
Header)" LOCATION:"。$ _ POST [redirect''}" .php?);
这会获得默认的其他。我不确定,但我认为这会将页面重新定向到起点吗?
谢谢,
if(empty($ id)){
$ vars =" type ="。$ type。"& param ="。$ param;
$ th ="< th>< a href =''idle_cars.php?"。$ vars。"& order_by = lease''> Rout e< /
a>< / th>";
$ TPL_carnumbers = GetHeaders($ th,$ vars);
$ result = GetCars(0,$ type,$ param,CLM_order_by($ order_by));
$ MSG_carlist =" IDLE CARS - NO MOVEMENT" .GetHeading($ type,$ param);
} else {
$ vars =" id ="。$ id。"& type ="。$ type。"& param ="。$ param;
$ TPL_carnumbers = GetHeaders('''',$ vars);
if($ _ SESSION [" LMS_USER_DESC"] ==''customer''){
$ result = GetCustomerCars($ id,'''',$ param,CLM_order_by($ order_ by));
$ MSG_carlist =" IDLE CARS - NO MOVEMENT " .GetHeading($ type,
$ param);
} else {
$ result = GetCars($ id,''leased '',$ param,CLM_order_by($ order_by));
$ MSG_carlist =" IDLE CARS - NO MOVEMENT" .GetHeading($ type,
$ param) " " .GetLeaseCompName($ id);
}
}
if($ _POST [''assign''] !=''在Excel中打开''){
if(mysql_numrows($ result)== 0){
$ TPL_carnumbers。= GetNoCarsMsg($ th);
} else {
while($ row = mysql_fetch_assoc($ result)){
$ TPL_carnumbers。= MakeSighting($ id,$ row);
}
}
$ TPL_carnumbers。="< / table> ;
包括header.php;
包括$ template_path。" template_carlist.html";
包括footer.php;
} elseif($ _POST [''assign''] ==''在Excel中打开''){
while($ row = mysql_fetch_assoc($ result)){
标题(" Location:idle_carsXL.php");
退出;
}
}
_POST(''assign''] =''在Excel中打开'')] ... {
} elseif(
_POST [''assign''] ==''在Excel中打开'')] ...
?
shouldn'不是别的吗?
或应该是
如果....
elseif ... ..
其他
(
_POST [''redirect'']&&
I''m trying to get error proof code.
I have this code which seems to work but now I look at it I think it
should be elseif not else and I wonder why it works. It is in the
block:
if($_POST(''assign'']=''Open in Excel'')]...{
}elseif($_POST[''assign'']==''Open in Excel'')]...
?
shouldn''t it be else instead of elseif?
or should it be
if....
elseif.....
else
($_POST[''redirect'']&&$_POST[''redirect''}!=$_SERVER[''PHP_SELF''}){
Header)"LOCATION: ".$_POST[redirect''}".php?);
this would get a default else. I am not sure but I think this would
redirect the page back to the starting point?
thanks,
if(empty($id)){
$vars = "type=".$type."¶m=".$param;
$th = "<th><a href=''idle_cars.php?".$vars."&order_by=lease''>Rout e</
a></th>";
$TPL_carnumbers = GetHeaders($th,$vars);
$result = GetCars(0,$type,$param,CLM_order_by($order_by));
$MSG_carlist = "IDLE CARS - NO MOVEMENT ".GetHeading($type,$param);
}else{
$vars = "id=".$id."&type=".$type."¶m=".$param;
$TPL_carnumbers = GetHeaders('''',$vars);
if($_SESSION["LMS_USER_DESC"]==''customer''){
$result = GetCustomerCars($id,'''',$param,CLM_order_by($order_ by));
$MSG_carlist = "IDLE CARS - NO MOVEMENT ".GetHeading($type,
$param);
}else{
$result = GetCars($id,''leased'',$param,CLM_order_by($order_by ));
$MSG_carlist = "IDLE CARS - NO MOVEMENT ".GetHeading($type,
$param)." ".GetLeaseCompName($id);
}
}
if ($_POST[''assign'']!=''Open in Excel''){
if(mysql_numrows($result)==0){
$TPL_carnumbers.= GetNoCarsMsg($th);
} else{
while ($row = mysql_fetch_assoc($result)){
$TPL_carnumbers.=MakeSighting($id,$row);
}
}
$TPL_carnumbers.="</table>";
include "header.php";
include $template_path."template_carlist.html";
include "footer.php";
}elseif ($_POST[''assign'']==''Open in Excel''){
while ($row = mysql_fetch_assoc($result)){
Header("Location: idle_carsXL.php");
exit;
}
}解决方案_POST(''assign'']=''Open in Excel'')]...{
}elseif(
_POST[''assign'']==''Open in Excel'')]...
?
shouldn''t it be else instead of elseif?
or should it be
if....
elseif.....
else
(
_POST[''redirect'']&&
这篇关于别的还是其他?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!