我正在使用P4A应用程序框架,我制作了一个下拉选择框,允许用户选择一个位置,当选择该位置时(并按下continue按钮),用户将转到一个新页面(取决于选择)。我被卡住的地方是在数据库中进行查询,以获得将用户定向到正确页面的位置ID,以下是我获得的代码:
$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");
}我很困惑,因为这是我需要的会议室系统应用程序的最后一点(减去一些非常小的细节)。
发布于 2012-10-31 19:46:13
我认为这很重要,但有一种更好的方法可以让这个系统使用小部件并将它们转移到活动页面,请查看p4a链接以了解详细信息:)
p4a通读文档以获取帮助
发布于 2012-10-31 00:13:19
忽略它,这并不重要:)
https://stackoverflow.com/questions/13088946
复制相似问题