PHP Login System with Admin Features

This forum was created to talk about the PHP Login System with admin features created by jpmaster77 on evolt's website


    Getting data from DB to the form

    Share
    avatar
    Dorji

    Number of posts : 25
    Registration date : 2009-03-30

    Getting data from DB to the form

    Post  Dorji on Wed Apr 01, 2009 9:26 am

    well then is an code in this login script geting the values from the DB to Form like
    Code:

    <input type="text" name="lname" maxlength="60" value="
    <?
    if($form->value("lname") == ""){
      echo $session->userinfo['lname'];
    }else{
      echo $form->value("lname");
    }
    ?>">
    BUT how do you do that for dropdown box

    Code:

    <select name="status">
    <option selected value="">Select</option>
    <option value="Single">Single</option>
    <option value="Married">Married</option>

    </select>

    So i am pretty sure you all know give me some idea abt how

    thanks
    avatar
    Linchpin311

    Number of posts : 220
    Age : 33
    Localisation : Long Island
    Registration date : 2007-05-14

    Re: Getting data from DB to the form

    Post  Linchpin311 on Wed Apr 01, 2009 10:33 pm

    something like this maybe?
    Code:
    <select name="status">

    <option value=""></option>
    <option value="Single"<?php if(isset($form->value("status")) && $form->value("status") == "Single") { echo ' selected'; }else{ if($session->userinfo['status'] == "Single") echo ' selected'; } ?>>Single</option>
    <option value="Married"<?php if(isset($form->value("status")) && $form->value("status") == "Married") { echo ' selected'; }else{ if($session->userinfo['status'] == "Married") echo ' selected'; } ?>>Married</option>

    </select>


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.
    avatar
    Dorji

    Number of posts : 25
    Registration date : 2009-03-30

    Thank you

    Post  Dorji on Thu Apr 02, 2009 2:52 am

    Thank you very much!!
    This Forum helps alot

    Sponsored content

    Re: Getting data from DB to the form

    Post  Sponsored content


      Current date/time is Wed Nov 14, 2018 12:58 am