Results 1 to 3 of 3

Thread: PhP form

  1. #1
    Join Date
    Jun 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PhP form

    Hi guys,

    i need some advice, am making a form and i want one field to be able to browse some data through MySQL,

    Any idea how i can do that, am very new to php and sql.

    Regards

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

  3. #3
    Join Date
    Jul 2007
    Location
    Azerbaijan, Baku
    Posts
    144
    Thanks
    11
    Thanked 27 Times in 25 Posts

    Default

    boogyman says true open that link, very useful.

    but lemme say it ^^:

    1. HTML:
    Code:
    <form method="POST">
    Name: <input name="myname" type="text" /><br/>
    Lastame: <input name="mylastname" type="text" /><br/>
    Homepage: <input name="mypage" type="text" /><br/>
    <input type="submit" name="submit">
    </form>
    2. PHP:

    Code:
    <?php
    include("dbconnect.php"); //Your db config...
    if(isset($_POST['submit'])){              //When you press submit button
    $name = $_POST['myname'];           //Myname text value
    $lastname = $_POST['mylastname'];  //Lastname text value
    $homepage = $_POST['mypage'];      // Homepage text value
    $result = mysql_query("INSERT INTO info(name, lastname, homepage) VALUES('$name', '$lastname', '$homepage')"); //inserts into table, you need to have table named info, and coloumns, name, lastname, homepage
    }
    ?>
    This was for inserting into table...

Bookmarks

Posting Permissions

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