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 11

Thread: Contact form

  1. #1
    Join Date
    Oct 2005
    Location
    Spain, Valencia
    Posts
    20,492
    Tokens
    3,575
    Habbo
    GoldenMerc

    Latest Awards:

    Default Contact form

    How would i make a contact form like this?
    http://habbcrazy.net/#pages/habbcrazy/contact
    +rep for help
    Ross

  2. #2
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    Here's a quickie for you (completely untested):
    PHP Code:
    <?php

    $emailTo
    ="[email protected]";
    $reasons=array("I have a question","I've spotted a mistake","I would like a job");

    if(
    $_POST['submit']!="true"){
         
    $reasonOptions="";
         foreach(
    $reasons as $key=>$value){$reasonOptions.="<option value='".($key+1)."'>".htmlentities($value)."</option>";}
         echo 
    "<head>\r\n"
         
    ."<title>Contact Us</title>\r\n"
         
    ."<style>body,td,input,textarea{font-family:arial,sans-serif;color:#777;}.b{font-weight:bold;}.r{text-align:right;}</style>\r\n"
         
    ."</head>\r\n"
         
    ."<body>\r\n"
         
    ."<form method='post'>\r\n"
         
    ."<input type='hidden' name='submit' value='true' />\r\n"
         
    ."<table>\r\n"
         
    ."<tr><td class='b r'>Habbo Name</td><td><input  type='text' name='habboname' /></td></tr>\r\n"
         
    ."<tr><td class='b r'>Email</td><td><input  type='text' name='emailaddress' /></td></tr>\r\n"
         
    ."<tr><td class='b r'>Reason</td><td><select name='reason'>{$reasonOptions}</select></td></tr>\r\n"
         
    ."<tr><td class='b r'>Message</td><td><textarea name='message'></textarea></td></tr>\r\n"
         
    ."<tr><td></td><td><input  type='submit' value='Send Message &raquo;' /></td></tr>\r\n"
         
    ."</table></form>\r\n"
         
    ."</body>\r\n";
    }else{
         
    // Get input
         
    $habboName=$_POST['habboname'];
         
    $emailAddress=$_POST['emailaddress'];
         
    $reason=$_POST['reason']-1;
         
    $reason=$reasons[$reason];
         
    $message=$_POST['message'];

         
    // Validate input
         
    if($habboName==""||$emailAddress==""||$reason==""||$message=="") die("<b>You left something out...</b><br />Please go back and try again.");

         if(!
    preg_match"/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/"$emailAddress)) die("<b>Invalid email address...</b><br />Please re-type your email address and try again.");
    }

         
    // Send email
         
    $mail=mail($emailTo,"Form Submission ({$reason})","Date: ".date("r (U)")."\r\n\r\nIP Address: {$_SERVER['REMOTE_ADDR']}\r\n\r\nHabbo Name: {$habboName}\r\n\r\nReturn email: {$emailAddress}\r\n\r\nReason: {$reason}\r\n\r\nMessage:\r\n{$message}","From: Your site");
          
         
    // Success or Error
         
    if($mail) die("<b>Message sent successfully.</b><br />Thank you for contacting us. We hope to reply within 24-48 hours.");
         else die(
    "<b>Unable to send email</b><br />Please try again later.");
    ?>
    Last edited by Apolva; 23-08-2010 at 12:33 AM.

  3. #3
    Join Date
    Oct 2005
    Location
    Spain, Valencia
    Posts
    20,492
    Tokens
    3,575
    Habbo
    GoldenMerc

    Latest Awards:

    Default

    Nono i think you misunderstood me, what i was trying to do was change the colour of the text box, as Habbcrazy have done
    Ross

  4. #4
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    Oh, like...

    Code:
    <head>
         <style>
              input,textarea
              {
                   border:1px solid #AAA;
                   border-bottom:2px solid #AAA;
                   padding:5px;
                   -moz-border-radius:5px;
                   border-radius:5px;
              }
         </style>
    </head>
    Last edited by Apolva; 23-08-2010 at 12:48 AM.

  5. #5
    Join Date
    Oct 2005
    Location
    Spain, Valencia
    Posts
    20,492
    Tokens
    3,575
    Habbo
    GoldenMerc

    Latest Awards:

    Default

    What i was hoping for was having as text box like HabbCrazys but a tad different then having a image in the background of the text box saying Quakal then when they clicked on it the Quakal part disapeared so they could write in it...
    Ross

  6. #6
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    Quote Originally Posted by GoldenMerc View Post
    What i was hoping for was having as text box like HabbCrazys but a tad different then having a image in the background of the text box saying Quakal then when they clicked on it the Quakal part disapeared so they could write in it...
    Ross
    You could just use normal text and javascript...

    Code:
    <input type='text' value='Quakal' onfocus='if(this.clicked==null){this.clicked=true;this.value="";}' />

  7. #7
    Join Date
    Oct 2005
    Location
    Spain, Valencia
    Posts
    20,492
    Tokens
    3,575
    Habbo
    GoldenMerc

    Latest Awards:

    Default

    Nah i don't think that'd look good enough

  8. #8
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    Quote Originally Posted by GoldenMerc View Post
    Nah i don't think that'd look good enough
    Code:
    <input type='text' style='background-image:url(quakal_logo.png);' onfocus='this.style.backgroundImage="";' />
    ?

  9. #9
    Join Date
    Oct 2005
    Location
    Spain, Valencia
    Posts
    20,492
    Tokens
    3,575
    Habbo
    GoldenMerc

    Latest Awards:

    Default

    That'd be it , Plus now i need to find a classy text box to fit with the logo inside the text box Hmmm

  10. #10
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    It looks a like like RadiPanel's form. Maybe you should check that out and study the CSS?
    Vouches
    [x][x]

Page 1 of 2 12 LastLast

Posting Permissions

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