我从 Webtecher 获得了这个美妙的数组结构,但是我正在努力将数据库中的值放入数组中以使它们被选中。
<?php
$a=array("","2","5","10","20","30","45","60","90","120");
$tsel = 3;
$tempo = PageDB::getInstance()->get_tempo_by_page_id($pageID);
echo '<label style="padding-right:28px;">Tempo</label>
<select name="tempo">';
for($i=1;$i<sizeof($a);$i++)
{echo '<option value="'.$i.'" '.($tsel==$i?'selected':'').'>'.$a[$i].' Sec</option>';if($tsel==$i)$a[0]=$tsel;}
echo '</select>';?>
如何调用和显示我的页面信息是通过这些查询和语句:
if ($_SERVER['REQUEST_METHOD'] == "POST")
$page = array("pid" => $_POST['pageID'],
"message_text" => $_POST['message_text'],
"message" => $_POST['message'],
"is_centered" => $_POST['is_centered'],
"inverted" => $_POST['inverted'],
"show_time" => $_POST['show_time'],
"show_temp" => $_POST['show_temp'],
"tempo" => $_POST['tempo'],
"transition" => $_POST['transition'],
"sunday" => $_POST['sunday'],
"monday" => $_POST['monday'],
"tuesday" => $_POST['tuesday'],
"wednesday" => $_POST['wednesday'],
"thursday" => $_POST['thursday'],
"friday" => $_POST['friday'],
"saturday" => $_POST['saturday'],
"start_date" => $_POST['start_date'],
"end_date" => $_POST['end_date'],
"start_time" => $_POST['start_time'],
"end_time" => $_POST['end_time'],
"campaignid" => $_POST['campaignid']);
else if (array_key_exists('pageID', $_GET)) {
$page = mysqli_fetch_array (PageDB::getInstance()->get_page_by_page_id($_GET['pageID']));
} else
$page = array(
"pid"=>"",
"message_text" => "",
"message" => "",
"is_centered" => "",
"inverted" => "",
"show_time" => "",
"show_temp" => "",
"tempo" => "",
"transition" => "",
"sunday" =>"",
"monday" =>"",
"tuesday" =>"",
"wednesday" =>"",
"thursday" =>"",
"friday" =>"",
"saturday" =>"",
"start_date" => "",
"end_date" => "",
"start_time" => "",
"end_time" => "");
非常感谢任何帮助!