Creating forms have a MySQL question

Discussion in 'Computers' started by Greg Haynes, Feb 23, 2004.

  1. Greg Haynes

    Greg Haynes Supporting Actor

    Joined:
    Oct 22, 1998
    Messages:
    577
    Likes Received:
    0
    Client of mine would to create a simply section on her site to input client information. I can create the form for her to enter but I need help with storing the data. I know I need to create a mySQL db using my hosts cpanel, I started playing with it and starting creating fields but how do I save all the data that the user enters into the db. Bascially how do I connect to the db using Dreamweaver MX.

    I just need some simple steps on setting the db up and having the data stored. Thanks in advance.
     
  2. Greg Haynes

    Greg Haynes Supporting Actor

    Joined:
    Oct 22, 1998
    Messages:
    577
    Likes Received:
    0
    I created a simply form with one textbox and a submit button. The database has been created with 2 fields with one field as an autonumber and the other a simply text field. The code is below with the form and so how do I have the text box assign to the field in my table. Do I need to write an SQL statement on website? If so how do assign an sql statement to the submit button.

    < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    < html>
    < head>
    < title>Untitled Document
    < meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    < /head>

    < body>


    < form name="form1" method="post" action="">

    < input type="text" name="textfield">
    < input type="submit" name="Submit" value="Submit">
    < /form>
    < /body>

    < /html>
     
  3. DaveF

    DaveF Moderator
    Moderator

    Joined:
    Mar 4, 2001
    Messages:
    17,962
    Likes Received:
    1,540
    Location:
    One Loudoun, Ashburn, VA
    Real Name:
    David Fischer
    Greg, as with your search question, you will need to use server-side processing. You need some logic code using PHP, Perl, etc. to process the information sent by the form and insert it into the database. I'm just a hobbyist and haven't done any database or PHP work in a while, but I don't think there's any way to do this with straight HTML or javascript.

    That said, it's pretty easy with a little PHP code. The PHP and MySQL websites have lots of good documentation. I recommend doing some reading there.
     

Share This Page