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!


Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2006
    Posts
    7
    Tokens
    0

    Default Contact Form for my website

    I'm wanting a 'Contact us' form for my website so that when they hit submit, the form gets sent to my email, and it goes back to my homepage. I've searched it on google, and tried a couple of codes, but none work?
    Help please.

  2. #2
    Join Date
    Feb 2005
    Posts
    2,503
    Tokens
    0

    Latest Awards:

    Default

    Hi,
    PHP Code:
    <?php
    $nasaadresa 
    "[email protected]";  //please replace this with your address

    $mail $_POST['Email'];
    $porukaa $_POST['Message'];
    $poruka str_replace("\r"'<br />'$porukaa);
    //START OF THANKS MESSAGE
    //you may edit $thanks message. this is a message which displays when user sends mail from your site
    $thanks "
    <p align='left'><br>
    <b>Your message has sucessfuly been sent!<br></b>
    #### MESSAGE TEXT #### 
    <br><br>
    $poruka
    <br><br>
    #### END OF MESSAGE ####
    <br><br>
    You will recive a copy of the message at your email address <b>(
    $mail).<br>We will reply you soon as possible<br></b></p>";
    //do not edit nothing below this line  until comment (ME) say so if you don't have skills with PHP
    //END OF THANKS MESSAGE

    if($_POST['submitform']) 
    {

        
    $Name $_POST['Name'];
        
    $Email $_POST['Email'];
        
    $Message $_POST['Message'];
        
    $require $_POST['require'];
        
    $browser $HTTP_USER_AGENT;
        
    $ip $_SERVER['REMOTE_ADDR'];

        
    $dcheck explode(",",$require);
        while(list(
    $check) = each($dcheck)) 
        {
            if(!$
    $dcheck[$check]) {
            
    $error .= "You have not filled this filed(s): <b>$dcheck[$check]</b>.<br>";
            }
        }
        if ((!
    ereg(".+\@.+\..+"$Email)) || (!ereg("^[[email protected]]+$"$Email))){
        
    $error .= "Wrong e-mail.<br>This e-mail address <b>$Email</b> - is not valid. Please enter correct e-mail address.";
        }
        if(
    $error)
        {
        echo 
    $error;
        echo 
    '<br><a href="#" onClick="history.go(-1)">Please try again.</a>';
        }
        else
        {
    //START OF INCOMING MESSAGE (this message goes to your inbox)
    $message "
    Name: 
    $Name:
    E-mail: 
    $Email

    Message: 
    $Message

    -----------------------------
    Browser: 
    $browser
    IP: 
    $ip
    "
    ;
    //END OF INCOMING MESSAGE (this message goes to your inbox)

    $subject "Message from www.yoursite.com - Message was sent by $Name"//subject OF YOUR INBOX MESSAGE sent to you

    $subject2 "You have succesfully sent message from www.yoursite.com!"//subject of OUTGOING MESSAGE - edit this
    //OUTGOING MESSAGE TEXT
    $message2 "You have sent a message to site admin of a www.yoursite.com:
    -----------------------------
    From: 
    $Name:
    E-mail: 
    $Email
        
    Message: 
    $Message

    -----------------------------
    "
    ;
    //END OF outgoing MESSAGE


    mail($nasaadresa,"$subject","$message","From: $Name <$Email>");
    mail($Email,"$subject2","$message2","From: <$nasaadresa>");
    echo 
    "$thanks";
        }
    }
    else{
    //this is contact form down here, please edit if you know what are you doing... or the contact form may not be working.
    echo '
    <p align="center"><br><b>Please contact us:</b></p><br><br>
    <form name="contactform" action="'
    .$PHP_SELF.'" method="post">
    <input type="hidden" name="require" value="Name,Email,Message">
      <table width="444" align="center">
        <tr>
          <td colspan="2" align="center">
            <p></td>
        </tr>
        <tr>
          <td valign="top" align="right"><b>Name:</b></td>
          <td valign="top">
            <input name="Name" size="30">
          </td>
        </tr>
        <tr>
          <td valign="top" align="right"><b>E-mail:</b></td>
          <td valign="top">
            <input name="Email" size="30">
          </td>
        </tr>
        <tr>
          <td valign="top" align="right"><b>Message:</b></td>
          <td valign="top">
            <textarea name="Message" rows="10" cols="30"></textarea>
          </td>
        </tr>
        <tr>
          <td colspan="2" align="center"><p align="right"><br>
            <input type="submit" value="Send" name="submitform">
            <input type="reset" value="Reset" name="reset"></p>
          </td>
        </tr>
      </table>
    </form>'
    ;
    }
    ?>
    That should work. You will just need to change the www.yoursite.com and the [email protected].
    Hope this helps.

  3. #3
    Join Date
    Dec 2006
    Posts
    7
    Tokens
    0

    Default

    How do I get it just as one box?
    No name or Message box.
    I tried deleting them.. but their still there. ^^

Posting Permissions

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