Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5

Thread: Editing Forms

  1. #1
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,656
    Member #
    1234
    Liked
    137 times
    Now what I mean by this is a form for editing information already in a database. A prime example of this is when you edit your user information for WDF. How do you have it auto populate fields in a form like that from the database? Here's an example table that everyone should be able to get their heads wrapped around:

    table name: addresses
    example row:
    address_id: 40
    address_1: 123 address way
    address_2: apt 205
    city: Nowhere
    state: NY
    zip_code: 11111

    So let's say the edit form is passed the address_id so that it can pull up the info and populate the form. How does it populate the editable areas?
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  2.  

  3. #2
    Senior Member dotcommakers's Avatar
    Join Date
    Oct 2003
    Posts
    527
    Member #
    3342
    Liked
    1 times
    this may help you

    I am not programmer

    but i worked little with this contact script where

    :: To list infomration for update this sql command is used

    Code:
    $sql = "select count(*) from contact";
       $result = mysql_query($sql ,$db);
       $row = mysql_fetch_row($result);
       $contact = $row[0];
    :: here is command to update fields

    Code:
    $sql = "update contact set email = 
    '$newemail' where email = '$oldemail'";
    hope this may give u idea

  4. #3
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,656
    Member #
    1234
    Liked
    137 times
    To clarify: grabbing the information, and replacing it is not the problem. Auto-filling out a pre-existing form is. Corrected original post for clarity.
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  5. #4
    Senior Member dotcommakers's Avatar
    Join Date
    Oct 2003
    Posts
    527
    Member #
    3342
    Liked
    1 times
    when you build a page for ......

    when you build a page for editing just put default value in filed .......

    like if you have email field

    Code:
    <input type=text name=email size=50 
    value='<?php printf($email); ?>'>
    k?

  6. #5
    Senior Member Brak's Avatar
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    3,413
    Member #
    1217
    Liked
    2 times
    Just a small note.. you can use <?=$email?> as a shortcut to <?php printf($email); ?>, it will work on 99% of webservers out there. Although, the one he put is very compatable.
    Kyle Neath: Rockstar extraordinare
    The blog | The poetry site | The Spore site


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 07:30 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com