1

私は Webtecher からこの素晴らしい配列構造を取得しましたが、DB から配列に値を取得して、それらを選択するのに苦労しています。

<?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" => "");

どんな助けでも本当に感謝しています!

4

0 に答える 0