新手網頁問題 Form

我整緊個 php 比 人修改會員資料
咁要 read 返個database ,填返d 野落個表單到,再比 user 改
textfield ,我搞店左
但係下拉式表單要點搞呢?
btw: 我已經係database 到 read 到邊個要selected
係咪要 javascript 幫手?thx

本帖最後由 kau 於 2010-5-9 23:56 編輯
  1. <?php
  2. $arr = array();
  3. $arr['0'] = array('value' => '1','selected' => FALSE);
  4. $arr['1'] = array('value' => '2','selected' => TRUE);
  5. ?>
  6. <select>
  7. <?php foreach ($arr as $v): ?>
  8.    <?php
  9.    if ($v['selected'] === TRUE){ $selected = 'selected';}
  10.    else {$selected = NULL;}
  11.     ?>

  12.     <option value="[color=Blue]<?php echo $v['value']?>[/color]" [color=Blue]<?php echo $selected?>[/color]">
  13.     [color=Blue]<?php echo $v['value']?>[/color]
  14.     </option>
  15. <?php endforeach; ?>
  16. </select>
複製代碼
Syntax highlighted: http://pastebin.org/213655

Is this what you need?

TOP

回復 2# kau

yes,thx

TOP

不用謝!

TOP