Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
  1. #11
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
    $db_host 
    "localhost";
    $db_user "";
    $db_pwd " ";
    $db_name "";
    mysql_connect($db_host$db_user$db_pwd);
    mysql_select_db($db_name);
    ?>
    <html>
    <head>
    <title>Profile</title>
    </head>
    <body>
    <?php
    if (!isset($_POST['submit'])) {
    ?>
    <form action="" method="post">
    First Name: <input type="text" name="name"><br>
    Last Name: <input type="text" name="lname"><br>
    Age: <input type="text" name="age"><br>
    Fav Color: <input type="text" name="color"><br>
    Best Friend: <input type="text" name="friend"><br>
    # Of Pets: <input type="text" name="pet"><br>
    # Of Siblings: <input type="text" name="sib"><br>
    Fav Town: <input type="text" name="ftown"><br>
    Home Town: <input type="text" name="htown"><br>
    Status: <input type="text" name="stat"><br>
    Gender: <input type="text" name="sex"><br>
    Grade: <input type="text" name="gr"><br>
    <input type="submit" name="submit" value="Submit!">
    </form>
    <?php
    } else {
    $name $_POST['name'];
    $lname $_POST['lname'];
    $age $_POST['age'];
    $color $_POST['color'];
    $friend $_POST['friend'];
    $sib $_POST['sib'];
    $ftown $_POST['ftown'];
    $htown $_POST['htown'];
    $stat $_POST['stat'];
    $sex $_POST['sex'];
    $gr $_POST['gr'];
    mysql_query("INSERT INTO `profile` (name, lname, age, color, friend, sib, ftown, htown, stat, sex, gr) VALUES ('$name', '$lname', '$age', '$color', '$friend', '$sib', '$ftown', '$htown', '$stat', '$sex', '$gr',)");
    echo 
    "Success! Your Profile has been added!";
    }
    ?>
    </body>
    </html>

  2. #12
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    nope :s

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  3. #13
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    new form handler still doesnt work:
    its only using 1 field the name one but if i can get name to work i can transfer it to the rest.
    PHP Code:
    <?
    $connection
    =mysql_connect("localhost","colinga_profile""profile") or die("Unable to connect!"); /* change this! */

    mysql_select_db("colinga_profile") or die("Unable to select database!"); /* change this! */

    $query="INSERT INTO profile (
                name)
            VALUES(
                '"
    .$name."')";

    $result=mysql_query($query) or die("Error in query:".mysql_error());
    //if ($result)
        //echo mysql_affected_rows()." row inserted into the database effectively.";


    mysql_close($connection);
    ?>

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


Page 2 of 2 FirstFirst 12

Posting Permissions

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