/    Sign up×
Community /Pin to ProfileBookmark

Help Creating a form to enter/retreive info from DB

Hi All,

I need help making a form that will allow me to create a database and enter information (name, lastname, id#, etc) into it. It will also allow me to add, edit and remove that data. Something like:

Name: Joe Lastname: Smith ID# 09-MIS1-T-001 Year: 2009 Status: Active

I also need to be able to select a year range and it will display on screen all data matching, like:

Year1: 2008 Year2: 2009

Name Lastname ID# Status
John Smith 08-MIS2-T-012 Active
Peter Cross 09-MIS2-T-015 Inactive
….

Anyone please?

Thanks,

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@jimr451Aug 18.2009 — It sounds like you really need an application, rather than a single form. If you do not need to "build it yourself" you might try searching hotscripts or another script site for a php address book.

If you want to build it yourself, there are many examples out there - but before you start, you should understand the following concepts:

  • 1. Database tables - creating them, querying them (sql), updating, etc.


  • 2. HTML forms - fields, processing the data, populating them, etc.


  • 3. programming concepts - specifically php scripting (not specifically the mysql functions, but the basic stuff)


  • If you have this background, the application you describe should be easy to put together by looking over the examples at php.net.

    Good Luck,

    -Jim
    Copy linkTweet thisAlerts:
    @YelgnidrocAug 18.2009 — Another concept to understand is mysql injection, and making forms secure.
    Copy linkTweet thisAlerts:
    @ixoraAug 27.2009 — This is exactly what I want to do. I understand concepts 1-2-3 and will investigate php.net.

    OZULLOA --- how is it going??
    Copy linkTweet thisAlerts:
    @ixoraAug 29.2009 — php.net not a great help to me. Decided to "build it myself". heehee

    Need to collect data from a form and store it in a data base. (Other functions to follow.) The form is fairly long so I am using a tiny test form to start.

    Have book.

    Created the database and one table through c-panel. Wrote a small script to test connection and it worked fine. Added the line to insert data BUT error code says database not selected. I can't see what might be wrong. Following lines are exact except for password.


    // open connection

    $conn=mysql_connect("localhost", "endte0_frankie", "password");

    mysql_select_db("endte0_FORUM", $conn);

    // insert into forumTable

    $sql="INSERT INTO forumTable values('Id','$_POST[name]','$_POST[submit_by]',

    '$_POST[comment]')";

    // execute sql statement

    $result=mysql_query($sql,$conn) or die(mysql_error());
    ×

    Success!

    Help @ozulloa spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.11,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,
    )...