2012-10-26 22 views
1

我正在使用P4A應用程序框架,我製作了一個下拉選擇框,允許用戶在選擇時選擇一個位置(並按下繼續按鈕)將用戶帶到新頁面(取決於所選內容)。在那裏我卡住正在在數據庫中查詢來獲取用戶引導到正確的頁面位置的ID,這裏是代碼我有: -獲取下拉選擇以引導用戶進入新頁面(MySQL && P4A應用程序框架)

$this->build("p4a_db_source", "login") 
    ->setTable("meetingrooms") 
    ->load() 
    ->firstRow(); 

    $this->build('p4a_field','location') 
    ->setSource($this->login) 
    ->setLabel('location') 
    ->setType('select') 
    ->setSourceValueField("ID") 
    ->setSourceDescriptionField("MeetingRoom") 
    ->setWidth(120); 


    $this->build("p4a_fieldset","Book") 
    ->anchor($this->location) 
    //->anchor($this->booking) 
    ->anchor($this->continue) 
    ->setLabel('Meeting room bookings'); 
    $this->display("main",$this->Book); 

} 
public function change() 
{ 
$location = $this->MeetingRoom->getNewValue(); 


$sql = "SELECT * FROM meetingrooms 
    WHERE 
      MeetingRoom = ?"; 
$row = p4a_db::singleton()->fetchRow($sql, array($location)); 

if ($row['MeetingRoom'] == "AreaOne")   
    {  
    p4a::singleton()->openmask("Area_One"); 
} 
else 
{ 
    $this->setTitle("Process Failed"); 
{ 
    elseif ($location=="AreaTwo") 
    { 
     p4a::singleton()->openmask("AreaTwo"); 
    } 
     elseif ($location=="AreaThree") 
     { 
      p4a::singleton()->openmask("AreaThree"); 
     } 

我不知所措這是應用程序,我需要的會議室系統的最後一位(減去一些非常小的細節。)

回答

3

我認爲這是很重要的,但有一個更更好的方法來使這個系統使用小部件並將它們轉移到活動頁面,請查看p4a鏈接瞭解詳情:)

p4a閱讀文檔以獲得幫助

相關問題