Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 2 of 2

Thread: How to send Form data to a MySQL database creater?

  1. #1

    How to send Form data to a MySQL database creater?

    Ok... I have 4 php files:
    Code:
     config.php
    opendb.php
    closedb.php
    create.php
    Now config holds all the MySQL connect data, opendb open the MySQL database, create puts the tables in the database, closedb closes the database.

    What I want to know is what php file I add a form to and how do i do this:
    A form with 4 inputs and a buttons (host, username, password and database) which will determine what details to use when loggin onto the MySQL db...

    How will I do this?
    My Photography
    Twitter

    K-Emmys-06: Best "Newbie"

  2. #2
    first off, not sure why u wanna be doing this, but thats ur part to think about...

    second, why do u have four files for such simple actions as opening ur connection, closing your connection etc.?

    once again, thats for u to think about too...

    to ur question:

    use an html form, with four <inputs>, each with a name that associates to what the data is, such as:
    Code:
    <input type="text" name="host">
    Then, have a submit button (if you don't know how to add a submit button, I suggest you learn plenty about HTML and some basic PHP first before doing this, otherwise you could be opening your system up to some serious security flaws).

    The form will submit to config.php using a POST, and grab that data by in ur PHP file doing:

    $host = $_POST['host'];

    Then use the variable $host in your connection info to the DB.
    "First time it's a mistake, do it again and it's stupidity."

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012