Forum Sementara Putera.com

Bersama kita perkemaskan forum ini sementara forum asal dalam pemulihan.

Forum putera dah kembali. Masalah sudah berjaya diselesaikan. Sila lawati http://forum.putera.com/tanya


    dynamic combo box + dynamic radio button

    Share

    daimon
    Moderators
    Moderators

    Number of posts : 245
    Age : 28
    Registration date : 12/02/2009

    dynamic combo box + dynamic radio button

    Post by daimon on Wed Jun 17, 2009 3:40 am

    salam buat semua~


    mcm mana nak fetch value utk combo box (untuk jadikan selected)?

    misalannya..
    dalam database aku set kuala lumpur

    <option value="melaka">Melaka</option>
    <option value="johor">Johor</option>
    <option value="kuala lumpur">Kuala Lumpur</option>


    dan aku nak dlm option <option value="kuala lumpur" selected>Kuala Lumpur</option> //option utk kuala lumpur tu jadi selected



    ===================

    ps: yang bawah ni plak cara aku connect dan fetch data dar mysql...

    <?php
    include('../includes/header.php');
    connect_db();
    ?>
    <?php
    $statement="select * from tb_branch where b_id=".$_GET['b_id'];
    //echo $statement;
    $result=mysql_query($statement);
    while($row=mysql_fetch_array($result))
    {
    $b_id=$row['b_id'];
    $b_name=$row['b_name'];
    }
    ?>

    johnburn
    Moderators
    Moderators

    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    Re: dynamic combo box + dynamic radio button

    Post by johnburn on Wed Jun 17, 2009 11:49 am

    daimon wrote:salam buat semua~


    mcm mana nak fetch value utk combo box (untuk jadikan selected)?

    misalannya..
    dalam database aku set kuala lumpur

    <option value="melaka">Melaka</option>
    <option value="johor">Johor</option>
    <option value="kuala lumpur">Kuala Lumpur</option>


    dan aku nak dlm option <option value="kuala lumpur" selected>Kuala Lumpur</option> //option utk kuala lumpur tu jadi selected



    ===================

    ps: yang bawah ni plak cara aku connect dan fetch data dar mysql...

    <?php
    include('../includes/header.php');
    connect_db();
    ?>
    <?php
    $statement="select * from tb_branch where b_id=".$_GET['b_id'];
    //echo $statement;
    $result=mysql_query($statement);
    while($row=mysql_fetch_array($result))
    {
    $b_id=$row['b_id'];
    $b_name=$row['b_name'];
    }
    ?>
    Code:

    <select name="b_id">
    <option value="melaka">Melaka</option>
    <option value="johor">Johor</option>
    <option value="kuala lumpur">Kuala Lumpur</option>
    </select>

    OngBok
    Moderators
    Moderators

    Gender : Male Number of posts : 729
    Location : Dungun Terengganu
    Job/hobbies : Pesara JKR
    Registration date : 18/02/2009

    Re: dynamic combo box + dynamic radio button

    Post by OngBok on Wed Jun 17, 2009 3:12 pm

    cuba cara nie:

    <select size="1" name="abjad">
    <option value="xyz">xyz</option>
    <option selected value="abc">abc</option>
    <option value="mno">mno</option>
    </select>

    Sponsored content

    Re: dynamic combo box + dynamic radio button

    Post by Sponsored content Today at 5:51 am


      Current date/time is Wed Dec 07, 2016 5:51 am