Click here to
get yummy grain feed
delivered to your RSS oven

rss

  • Businesswing Design BLOG
  • Assist to join the global market.
5-4 條件判斷式用於表單網頁的接收

Date:八月 16, 2010 | Author:bwingnet

當表單將資料送出後,PHP接收資料時,我們就可依照前面介紹的條件判斷式語法,在接收資料時進行分析。例如我將第四章討論過的核選框表單網頁4.htm另存新檔為4new.htm,並將「action="4.php"」改為「action="4new.php"」,或請參考檔案名稱:「5」資料夾內「4new.htm」,接收網頁可以如此設計:

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用過哪些作業系統的接收1:加上條件判斷</title></head>
<body>
<? if($_GET['vista'] or $_GET['xp'] or $_GET['win2k'])
   {  
$win.=$_GET['vista']."/";
      $win.=$_GET['xp']."/"
$win.=$_GET['win2k']."/";
echo '您挑選了以下的Windows系統:'.$win."<hr>";
    }
if($_GET['fedora'] or $_GET['opensuse'] or $_GET['ubuntu'])
{ 
$linux.=$_GET['fedora']."/";
$linux.=$_GET['opensuse']."/";
$linux.=$_GET['ubuntu']."/";
echo '您挑選了以下的Linux系統:'.$linux."<hr>";
} 	?> </body></html>

php_ch5-15【圖15 接收表單網頁與條件判斷】

+Read more

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

  Categories: 網頁程式PHP,網頁設計 | Tags: ,
        
5-3-2 邏輯運算子

Date:八月 9, 2010 | Author:bwingnet

邏輯運算子主要用if或elseif內,當條件本身是否為真或假,會影響到判斷時,我們可藉由邏輯運算子協助取得資訊。

首先,我們先來看PHP有哪些邏輯運算子可以運用:

符號 範例 說明
and $a and $b 如果$a與$b都為真,那就會傳回真,否則傳回假
or $a or $b 如果$a與$b其中一個為真,那就會傳回真,否則傳回假
xor $a xor $b 如果$a與$b若均為真或為假,那就會傳回假,否則傳回真
! !$a 若$a為真,則會傳回假,若$a為假,則會傳回真

首先我們以範例說明and的用法:

+Read more

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

  Categories: 網頁程式PHP,網頁設計 | Tags: ,
         top