PHP Form to MySQL DB Script???

Discussion in 'PHP' started by jawinn, Sep 27, 2006.

  1. #1
    Can anyone point me to a script (preferably free) that would take form data and parse it into a MySQL DB?

    thx
     
    jawinn, Sep 27, 2006 IP
  2. Evoleto

    Evoleto Well-Known Member

    Messages:
    253
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    This totally depends on what info you are collecting. Then design the MySQL tables, then write the script to populate them. So first give us your form.
     
    Evoleto, Sep 27, 2006 IP
  3. jawinn

    jawinn Active Member

    Messages:
    1,024
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    88
    #3
    That would make sense. :D

    Here it is.

    <form method="post" action="index.php" />
    First Name;&nbsp;Last Name<br>
    <input type="text" name="first" />&nbsp;&nbsp;<input type="text" name="last" /><br/><br>
    City&&nbsp;&nbsp;State<br>
    <input type="text" name="city" />&nbsp;&nbsp;<select name="state" />
    <option>Alabama</option>
    <option>Alaska</option>
    <option>Arizona</option>
    <option>Arkansas</option>
    <option>California</option>
    <option>Colorado</option>
    <option>Connecticut</option>
    <option>Delaware</option>
    <option>Florida</option>
    <option>Georgia</option>
    <option>Hawaii</option>
    <option>Idaho</option>
    <option>Illinois</option>
    <option>Indiana</option>
    <option>Iowa</option>
    <option>Kansas</option>
    <option>Kentucky</option>
    <option>Louisiana</option>
    <option>Maine</option>
    <option>Maryland</option>
    <option>Masachusetts</option>
    <option>Michigan</option>
    <option>Minnesota</option>
    <option>Mississippi</option>
    <option>Missouri</option>
    <option>Montana</option>
    <option>Nebraska</option>
    <option>Nevada</option>
    <option>New Hampshire</option>
    <option>New Jersey</option>
    <option>New Mexico</option>
    <option>New York</option>
    <option>North Carolina</option>
    <option>North Dakota</option>
    <option>Ohio</option>
    <option>Oklahoma</option>
    <option>Oregon</option>
    <option>Pennsylvania</option>
    <option>Rhode Island</option>
    <option>South Carolina</option>
    <option>South Dakota</option>
    <option>Tennessee</option>
    <option>Texas</option>
    <option>Utah</option>
    <option>Vermont</option>
    <option>Virginia</option>
    <option>Washington</option>
    <option>West Virginia</option>
    <option>Wisconsin</option>
    <option>Wyoming</option>
    </select><br/><br>
    E-mail Address<br>
    <input type="text" name="email" /><br/><br>
    Answer: <input type="radio" name="answer" value="A" /> A<input type="radio" name="answer" value="B" /> B<input type="radio" name="answer" value="C" /> C<input type="radio" name="answer" value="D" /> D<br/>
    <input type="checkbox" name="remember" value="1" /> Remember Me<br/><br/>
    <input type="submit" name="submit" value="Submit" />
    </form>

    The basic function is for people to enter in 1 of four answers (A B C or D). I'd like to have those answers along with the people's info to be dumped into a MySQL DB. Furthermore have the script toss back an error message if a duplicate email address is used. Lastly I want to be able to do a simple query to randomly select a winner from the correct answers.

    Any help is much appreciated.

    J
     
    jawinn, Sep 27, 2006 IP
  4. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi,

    I strongly suggest you learn PHP and SQL; we can't exactly write this for you.

    You will need at a minimum to know SELECT and INSERT statements, and the MySQL API within PHP. I suggest using mysqli if it is available; start with the documentation.

    Regards
    - P
     
    penagate, Sep 27, 2006 IP
  5. jawinn

    jawinn Active Member

    Messages:
    1,024
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    88
    #5
    Thanks, but I'm not looking for some one to write this for me. I am wondering if there is a script that already exists that does this.
     
    jawinn, Sep 27, 2006 IP
  6. aditya_sfs

    aditya_sfs Peon

    Messages:
    2,271
    Likes Received:
    389
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Learning PHP is fun, not a hard task... i would suggest if you are into web designing then know PHP intead of simply using premade scripts. Since many a times you will need PHP knowlege even with premade scripts.

    regards
    aditya
     
    aditya_sfs, Sep 28, 2006 IP