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 19

Thread: Forms

  1. #1
    Join Date
    Aug 2006
    Posts
    6,572
    Tokens
    584

    Latest Awards:

    Default Forms

    Hey,

    I was wondering if anyone could help me with setting up a form on a page that I can recieve the data, for example.

    PHP Code:
    Name:
    Anything
                          
    SEND 
    When they click send I get that info in my email or somewhere I can access.

    I will try rep+ any help!

    Thanks.

  2. #2
    Join Date
    Feb 2009
    Location
    London
    Posts
    935
    Tokens
    100
    Habbo
    Sameer!

    Latest Awards:

    Default

    PHP Code:
    <?php
    if(isset($_POST["name"]) && isset($_POST["email"]) && isset($_POST["subject"]) && isset($_POST["query"]) && isset($_POST["other"]))
    {

    $name $_POST["name"];
    $email $_POST["email"];
    $other $_POST["other"];
    $query $_POST["query"];

    $message "The following was sent from your contact form:

    Name: 
    $name

    Email: 
    $email

    Query: 
    $query

    Other: 
    $other";

    $to "[email protected]";
    $subject "MyForm Submission RE: ".$_POST["subject"]."";
    mail($to$subject$message);

    echo(
    "Thank you! Your submission was sent successfully!");
    }
    else
    {
    echo(
    'Fill out the form below to contact us. You will receive a reply within 24 hours.<br />
    <form method="post" act="contact.php">
    <fieldset>
        <legend>Name</legend>
        <input type="text" name="name" />
    </fieldset>
    <fieldset>
        <legend>Email</legend>
        <input type="text" name="email" />
    </fieldset>
    <fieldset>
         <legend>Subject</legend>
         <input type="text" name="subject" />
    </fieldset>
    <fieldset>
          <legend>Query</legend>
          <textarea rows="3" name="query"></textarea>
    </fieldset>
    <fieldset>
          <legend>Other</legend>
          <input type="text" name="other" />
    </fieldset>
    <br /><input type="submit" value="Contact Us" />
    </form>'
    );
    }
    ?>

    There you go! Took me 5 mins to code or so.

  3. #3
    Join Date
    Aug 2006
    Posts
    6,572
    Tokens
    584

    Latest Awards:

    Default

    I am not a genius at these things, do I need to create a contact.php page and if so what does it need to include?

  4. #4
    Join Date
    Nov 2006
    Posts
    7,395
    Tokens
    2,222

    Latest Awards:

    Default

    Quote Originally Posted by Sam Carvalho View Post
    I am not a genius at these things, do I need to create a contact.php page and if so what does it need to include?
    make a contact.php page and paste the code that the guy above showed you
    Hi

  5. #5
    Join Date
    Aug 2006
    Posts
    6,572
    Tokens
    584

    Latest Awards:

    Default

    Quote Originally Posted by Cixso View Post
    make a contact.php page and paste the code that the guy above showed you
    Ok I'll do that now, cheers.

  6. #6
    Join Date
    Aug 2006
    Posts
    6,572
    Tokens
    584

    Latest Awards:

    Default

    Sorry for the double post.

    I don't seem to be recieving the data that sends it to my email, is there anyway to fix this?
    I have set the email to mine and tried with a domain email to.
    Last edited by efq; 20-02-2009 at 03:27 PM.

  7. #7
    Join Date
    Nov 2006
    Posts
    7,395
    Tokens
    2,222

    Latest Awards:

    Default

    Make a page called contactform.php

    In it... add:

    HTML Code:
    <form onKeyUp="highlight(event)" onClick="highlight(event)" name-"agreeform" onSubmit="return defaultagree(this)" action="sendmail.php" method="post" class="style1">
      <p><span class="style2">
      <?php
    $ipi = getenv("REMOTE_ADDR");
    $httprefi = getenv ("HTTP_REFERER");
    $httpagenti = getenv ("HTTP_USER_AGENT");
    ?>
      
    <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
      <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
      <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
      
    
      <strong>Your Name: </strong><br />
      <input type="text" name="visitor" size="35" />
      </span></p>
      <p><span class="style2"><strong>Your Email:</strong><br />
        <input type="text" name="visitormail" size="35" />
        <br />
        <br />
        <strong>Subject:</strong><br />
        <select name="attn" size="1">
          <option value=" Bug Reporting ">Bug Reporting </option>
          <option value=" Career Options ">Link us </option>
          <option value=" Abuse Report ">Abuse Report </option>
          <option value=" Webmaster ">Webmaster </option>
          <option value=" Other ">Other </option>
            </select>
      </span></p>
      <p><span class="style2"><span class="style3">NOTE: If you are linking us, please provide your logo URL in the mail message! </span><br />
        <br />
        <strong>Mail Message:
        </strong><br />
        <textarea name="notes" rows="4" cols="40"></textarea>
        </span></p>
      <p>
        <textarea name="textarea" cols="40" rows="3" wrap="VIRTUAL">By using this form you agree not to spam or abuse the purpose of this contact form. By submitting you agree that your IP is stored for security reasons and you agree we store your name and email. You agree to submit valid descriptions of your purpose for contacting us.</textarea>
        <br />
        <span class="style2">
        <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)">
        I agree to the above terms</span><br>
        <input type="submit" value="Send Mail" disabled>
        <input type="reset" name="Reset" value="Reset">
      </p>
    </form>
    Then make a sendmail.php page and add:

    HTML Code:
    <?php
    
    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $visitor = $_POST['visitor'];
    $visitormail = $_POST['visitormail'];
    $notes = $_POST['notes'];
    $attn = $_POST['attn'];
    
    
    if (eregi('http:', $notes)) {
    die ("Do NOT try that! ! ");
    }
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
    {
    echo "- Invalid email. Enter a @domain email.\n";
    $badinput = "Form was not submited.\n";
    echo $badinput;
    die ("Please go back and try again. ");
    }
    
    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    echo "<b>Error:</b> Not all feilds where filled.\n";
    die ("Please go back and correct this error.");
    }
    
    $todayis = date("l, F j, Y, g:i a") ;
    
    $attn = $attn ;
    $subject = $attn;
    
    $notes = stripcslashes($notes);
    
    $message = " $todayis [EST] \n
    Attention: $attn \n
    Message: $notes \n
    From: $visitor ($visitormail)\n
    Additional Info : IP = $ip \n
    Browser Info: $httpagent \n
    Referral : $httpref \n
    ";
    
    $from = "From: $visitormail\r\n";
    
    
    mail("[email protected]", $subject, $message, $from);
    
    ?>
    <p align="left">
    Date: <?php echo $todayis ?>
    <br />
    Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
    <br />
    
    Subject: <?php echo $attn ?>
    <br />
    Message:<br />
    <?php $notesout = str_replace("\r", "<br/>", $notes);
    echo $notesout; ?>
    <br />
    <?php>
    ****, hold on, the sendmail.php code is ******. Anybody correct it please?
    Hi

  8. #8
    Join Date
    Aug 2006
    Posts
    6,572
    Tokens
    584

    Latest Awards:

    Default

    Quote Originally Posted by Cixso View Post
    Make a page called contactform.php

    In it... add:

    HTML Code:
    <form onKeyUp="highlight(event)" onClick="highlight(event)" name-"agreeform" onSubmit="return defaultagree(this)" action="sendmail.php" method="post" class="style1">
      <p><span class="style2">
      <?php
    $ipi = getenv("REMOTE_ADDR");
    $httprefi = getenv ("HTTP_REFERER");
    $httpagenti = getenv ("HTTP_USER_AGENT");
    ?>
      
    <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
      <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
      <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
      
    
      <strong>Your Name: </strong><br />
      <input type="text" name="visitor" size="35" />
      </span></p>
      <p><span class="style2"><strong>Your Email:</strong><br />
        <input type="text" name="visitormail" size="35" />
        <br />
        <br />
        <strong>Subject:</strong><br />
        <select name="attn" size="1">
          <option value=" Bug Reporting ">Bug Reporting </option>
          <option value=" Career Options ">Link us </option>
          <option value=" Abuse Report ">Abuse Report </option>
          <option value=" Webmaster ">Webmaster </option>
          <option value=" Other ">Other </option>
            </select>
      </span></p>
      <p><span class="style2"><span class="style3">NOTE: If you are linking us, please provide your logo URL in the mail message! </span><br />
        <br />
        <strong>Mail Message:
        </strong><br />
        <textarea name="notes" rows="4" cols="40"></textarea>
        </span></p>
      <p>
        <textarea name="textarea" cols="40" rows="3" wrap="VIRTUAL">By using this form you agree not to spam or abuse the purpose of this contact form. By submitting you agree that your IP is stored for security reasons and you agree we store your name and email. You agree to submit valid descriptions of your purpose for contacting us.</textarea>
        <br />
        <span class="style2">
        <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)">
        I agree to the above terms</span><br>
        <input type="submit" value="Send Mail" disabled>
        <input type="reset" name="Reset" value="Reset">
      </p>
    </form>
    Then make a sendmail.php page and add:

    HTML Code:
    <?php
    
    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $visitor = $_POST['visitor'];
    $visitormail = $_POST['visitormail'];
    $notes = $_POST['notes'];
    $attn = $_POST['attn'];
    
    
    if (eregi('http:', $notes)) {
    die ("Do NOT try that! ! ");
    }
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
    {
    echo "- Invalid email. Enter a @domain email.\n";
    $badinput = "Form was not submited.\n";
    echo $badinput;
    die ("Please go back and try again. ");
    }
    
    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    echo "<b>Error:</b> Not all feilds where filled.\n";
    die ("Please go back and correct this error.");
    }
    
    $todayis = date("l, F j, Y, g:i a") ;
    
    $attn = $attn ;
    $subject = $attn;
    
    $notes = stripcslashes($notes);
    
    $message = " $todayis [EST] \n
    Attention: $attn \n
    Message: $notes \n
    From: $visitor ($visitormail)\n
    Additional Info : IP = $ip \n
    Browser Info: $httpagent \n
    Referral : $httpref \n
    ";
    
    $from = "From: $visitormail\r\n";
    
    
    mail("[email protected]", $subject, $message, $from);
    
    ?>
    <p align="left">
    Date: <?php echo $todayis ?>
    <br />
    Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
    <br />
    
    Subject: <?php echo $attn ?>
    <br />
    Message:<br />
    <?php $notesout = str_replace("\r", "<br/>", $notes);
    echo $notesout; ?>
    <br />
    <?php>
    ****, hold on, the sendmail.php code is ******. Anybody correct it please?
    Yeah the sendmail.php is broken, does anyone know how to fix it?

  9. #9
    Join Date
    Aug 2006
    Posts
    6,572
    Tokens
    584

    Latest Awards:

    Default

    Does anyone have a sendmail.php?
    I have managed to sort everything else, I just need that

    I'll rep+

  10. #10
    Join Date
    Nov 2006
    Posts
    7,395
    Tokens
    2,222

    Latest Awards:

    Default

    PHP Code:
    <?php

    $ip 
    $_POST['ip'];
    $httpref $_POST['httpref'];
    $httpagent $_POST['httpagent'];
    $visitor $_POST['visitor'];
    $visitormail $_POST['visitormail'];
    $notes $_POST['notes'];
    $attn $_POST['attn'];


    if (
    eregi('http:'$notes)) {
    die (
    "Do NOT try that! ! ");
    }
    if(!
    $visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
    {
    echo 
    "- Invalid email. Enter a @domain email.\n";
    $badinput "Form was not submited.\n";
    echo 
    $badinput;
    die (
    "Please go back and try again. ");
    }

    if(empty(
    $visitor) || empty($visitormail) || empty($notes )) {
    echo 
    "<b>Error:</b> Not all feilds where filled.\n";
    die (
    "Please go back and correct this error.");
    }

    $todayis date("l, F j, Y, g:i a") ;

    $attn $attn ;
    $subject $attn;

    $notes stripcslashes($notes);

    $message $todayis [EST] \n
    Attention: 
    $attn \n
    Message: 
    $notes \n
    From: 
    $visitor ($visitormail)\n
    Additional Info : IP = 
    $ip \n
    Browser Info: 
    $httpagent \n
    Referral : 
    $httpref \n
    "
    ;

    $from "From: $visitormail\r\n";


    mail("[email protected]"$subject$message$from);

    ?>

    <p align="left">
    Date: <?php echo $todayis ?>
    <br />
    Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
    <br />

    Subject: <?php echo $attn ?>
    <br />
    Message:<br />
    <?php $notesout str_replace("\r""<br/>"$notes);
    echo 
    $notesout?>
    <br />
    <?php echo $ip ?>
    Try now.

    Works, just tried - fixed it my self ;D
    Last edited by Cixso; 21-02-2009 at 10:11 AM.
    Hi

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
  •