Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ANy one help me plzzzzzzzz

    I m new for php world . I want to know when we updating the profile form like in orkut , it contains previous value what we filled ... how is this possible

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    It gets the info from a database. Use a descriptive thread title next time too please

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well firstly read this, particularly point 2.

    As for the pre-filled values in the form, well that's pretty simple if you're pulling the data for the user out of a database you'd have a script something like:

    PHP Code:
    <?php

    $link 
    mysql_connect('localhost''mysql_user''mysql_password');
    $select_db mysql_select_db('database_name'$link);

    $query "SELECT * FROM table_name WHERE username='" $_POST['username'] . "' AND password='" $_POST['password'"' LIMIT 1";
    $result mysql_query($query$link);
    $numrows mysql_num_rows($result);

    if(
    $numrows 0) {
        
    $row mysql_fetch_assoc($result);
        
    ?>
        <form name="myform" action="somescript.php" method="post">
            <input type="text" name="name" value="<?php echo $row['name']; ?>" />Name<br />
            <input type="text" name="name" value="<?php echo $row['address']; ?>" />Address<br />
            <input type="text" name="name" value="<?php echo $row['age']; ?>" />Age<br />
            <input type="submit" name="submit" value="Submit" />
        </form>
        <?php

    } else {

        echo 
    'User profile not found.';

    }
    ?>
    Obviously you'll need to heavily modify it to fit in with your form fields and database, etc but that's essentially the basics, you just fill out the value="" part of the form with the data you want to pre-populate. If you get stuck then post what went wrong.

  • #4
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanx it's working


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •