Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Oni Guest

    Default Whats code for this?

    As you probably know im a php noob but I want to know the code for the following.
    A kind of form where you submit your
    Name:
    Site:
    Description:
    Then everyone else can view it.
    Thanks, rep for all helpers.

  2. #2
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    If no-one helps, message me on MSN when I come on and ill make the code for you.

  3. #3
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

  4. #4
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Thats a contact form which uses the mail() function.

    How will this enable

    That veryone else can view it.
    He needs a regular script made which inserts the data into an SQL database and then display the data on a different page.

  5. #5
    Oni Guest

    Default

    I still need help so can you msn me whn your on? Ill be on appear offline.

  6. #6
    Join Date
    Oct 2006
    Posts
    119
    Tokens
    0

    Default

    I have a sandbox that I made that will do a pretty basic version of that

    do you just want a linear view, like

    Name
    Info
    Info2
    Info3
    -----------
    Name
    Info
    Info2
    Info3
    -----------
    Name
    Info
    Info2
    Info3
    -----------
    Name
    Info
    Info2
    Info3
    -----------
    Name
    Info
    Info2
    Info3
    or something else?

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

    Latest Awards:

    Default


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


  8. #8
    Join Date
    Oct 2006
    Posts
    119
    Tokens
    0

    Default

    Can you use MySQL databases?

  9. #9
    Join Date
    Oct 2006
    Posts
    119
    Tokens
    0

    Default

    Okay, I just tested this on my host, but I'm half asleep and I don't know if it'll work for you... it's also only half of the code (it'll do the database portion, but you won't see anything)
    ---------------------------------------------------------------

    First log into your host and make a database, write down the name. Then create a table in that database, with these settings:



    and fill it with these values:



    You should now have a database name, a username, a password, and a table name.

    form.html
    Code:
    <form action="processor.php" method="post">
    First Name: <input type="text" name="first"><br />
    Last Name: <input type="text" name="last"><br />
    Hometown: <input type="text" name="home"><br />
    Status: <input type="text" name="status"><br />
    Grade: <select name="grade">
    <option></option>
    <option>7</option>
    <option>8</option>
    <option>9</option>
    <option>10</option>
    <option>11</option>
    <option>12</option>
    <option>NA</option>
    </select><br />
    School: <input type="text" name="school"><br />
    Sex: <select name="sex">
    <option>M</option>
    <option>F</option>
    </select><br />
    Favourite Town: <input type="text" name="town"><br />
    Favourite Color: <input type="text" name="color"><br />
    Best Friend(s): <input type="text" name="friends"><br />
    Pets: <input type="text" name="pets"><br />
    Siblings: <input type="text" name="siblings"> <br />
    <input type="submit" name="submit" value="Submit">&nbsp;&nbsp;<input type="reset" name="reset" value="Reset">
    </form>
    processor.php
    PHP Code:
    <?php

    #-----------------------Config Variables---------------------------
    $sitename "localhost"// Change only if your database is not on the same host as this page
    $username "myusername"// Change this to your username
    $password "mypass"// Change this to your password
    $dbname "database"// Change this to your database name


    #---------------------Connect to Database--------------------------
    if ( $sqldb mysql_connect($sitename$username$password ) ) {
       print 
    "Connection complete<br>";
    }
    else {
       die (
    "Unable to connect to database. Error: <b>".mysql_error()."</b>");
    }

    if ( 
    mysql_select_db$dbname$sqldb )  ) {
      print 
    "Select of database complete!<br>";
    }
    else {
      die (
    "Select of database failed. Error number: <b>".mysql_errno()." Message: ".mysql_error()."</b>");
    }


    #-----------------Set user-defined variables-----------------------
    $fir $_POST['first'];
    $lat $_POST['last'];
    $hom $_POST['home'];
    $sta $_POST['status'];
    $gra $_POST['grade'];
    $sch $_POST['school'];
    $sex $_POST['sex'];
    $tow $_POST['town'];
    $col $_POST['color'];
    $fri $_POST['friends'];
    $pet $_POST['pets'];
    $sib $_POST['siblings'];

    #-----------------Insert the data into the database-----------------
    $query 'INSERT INTO \''.$dbname.'\' (\'First\',\'Last\',\'Home\',\'Status\',\'Grade\',\'School\',\'Sex\',\'Town\',\'Color\',\'Friends\',\'Pets\',\'Siblings\') 
    VALUES ($fir,$lat,$hom,$sta,$gra,$sch,$sex,$tow,$col,$fri,$pet,$sib)'
    ;

    mysql_query($query);

    #-------------------Close the database - Important!----------------- 
    mysql_close($sqldb);
    ?>
    rest coming soon, or someone else can write it. G'night

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

    Latest Awards:

    Default

    if he wonts the code from mine he can have it.

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


Page 1 of 2 12 LastLast

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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