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 3 123 LastLast
Results 1 to 10 of 27
  1. #1

    Default whats my form action?

    This is my form:

    PHP Code:
    <p><strong>Contact form</strong></p>
            <
    form id="form1" name="form1" method="post" action="send_contact.php">
              <
    p>Name:            
                <
    input type="text" name="name" id="name" />
              </
    p>
              <
    p>&nbsp;</p>
              <
    p>E-Mail Address
                <
    input type="text" name="email" id="email" />
              </
    p>
              <
    p>&nbsp;</p>
              <
    p>Subject of Enquiry
                <
    input type="text" name="subject" id="subject" />
              </
    p>
              <
    p>&nbsp;</p>
              <
    p>Please enter your message below: </p>
              <
    p>
                <
    textarea name="message" id="message" cols="45" rows="5"></textarea>
              </
    p>
              <
    p align="center">
                <
    input type="submit" name="submit" id="submit" value="Submit" />
                <
    input type="reset" name="reset" id="reset" value="Reset" />
              </
    p>
            </
    form
    What would be my form action on send_contact.php?

    +rep to all contributors (where possible)

    Also - how do I record IP addresses, and show it to users, like on Galaxy-Webhosting?
    and how do I make it so you cannot submit the form without the fields filled in?

    Sorry for my n00b =[.

    TML

    Closed by Meti (Forum Moderator): Thread closed due to arguments.
    Last edited by Meti; 30-10-2008 at 09:57 PM.

  2. #2
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    You wanting the form to be emailed to you?

  3. #3
    Join Date
    Jun 2008
    Location
    Manchester
    Posts
    766
    Tokens
    0

    Default

    Clientside form validation:
    Code:
    <head>
    <script>
    function validate(){
    if(document.form1.name.value==null||document.form1.name.value=''){
    alert('Please enter your name.'); return false;
    }
    if(document.form1.email.value=null||document.form1.email.value=''){
    alert('Please enter your email.'); return false;
    }
    </script>
    </head>
    ...
    <form blahblah... onSubmit="return validate()">
    Hopefully that should work.

  4. #4

    Default

    yes id like it emailed to [email protected]

  5. #5

    Default

    I wouldn't recommend using Jxhn javascript, you're best off using server side validation because people can easily disable javascript - and that means they'll need not valid so you'll need to impliment it on server side anyway.

    You can attach the IP by appending $_SERVER['REMOTE_ADDR'] on the email and that will allow the reader to see who emailed it.

  6. #6
    Join Date
    Jun 2008
    Location
    Manchester
    Posts
    766
    Tokens
    0

    Default

    Quote Originally Posted by Iszak View Post
    I wouldn't recommend using Jxhn javascript, you're best off using server side validation because people can easily disable javascript - and that means they'll need not valid so you'll need to impliment it on server side anyway.
    Seriously who'd do that just to send a blank email. It doesn't really matter if they do, it's only for people that forget or don't realise they have to fill out some fields, if they're really determined they'd used an invisible character and unless the php checked for them then it'd get past that aswell.

    It's not like his website is gonna get hacked if he doesn't know their name.

    And with javascript you can use onBlur to make forms validate when they're deselected.
    Last edited by Jxhn; 26-10-2008 at 07:43 AM.

  7. #7

    Default

    Well search engines have javascript disabled and many if not most do submit the forms to extend your site index listing - so you'll get fake emails sent from search engines. Also this will allow your site to be susceptible to spamming and I mean, why bother? when it's just as easier to make the backend validate. But hey, up to you, obviously you don't care about spam.

  8. #8

    Default

    Thanks for your help.

    I'm not worried about people sending spam emails, its just a website for a client. Its just so people remember to put their email so we ca reply to them.

    Dreamweaver dosn't have a tool for creating a form action page, so i'm kind of screwed =[

  9. #9
    Join Date
    Jun 2008
    Location
    Manchester
    Posts
    766
    Tokens
    0

    Default

    Quote Originally Posted by Iszak View Post
    Well search engines have javascript disabled and many if not most do submit the forms to extend your site index listing - so you'll get fake emails sent from search engines. Also this will allow your site to be susceptible to spamming and I mean, why bother? when it's just as easier to make the backend validate. But hey, up to you, obviously you don't care about spam.
    Search engines don't submit forms as far as I know, it's never happened on any site I've run and if it did happen thenthe bot would find it's way into insecure sites and end up deleting pages, databases etc.

    Also you'd need a captcha sort of thing to stop spam.

  10. #10
    Join Date
    Jan 2006
    Location
    UNKNOWN TO EARTH
    Posts
    264
    Tokens
    0

    Default

    Here, it's in PHP so you don't need to play around.

    PHP Code:
    <b>Form:</b>
    <?php
    if(isset($_POST['send'])) {
    if((empty(
    $name) || empty($email) || empty($subject) || empty($message)) {
    echo 
    "One of the fields hasn't been filled in!";
    } else {
    $name addslashes(htmlspecialchars($_POST['name']));
    $email addslashes(htmlspecialchars($_POST['email']));
    $subject addslashes(htmlspecialchars($_POST['subject']));
    $message addslashes(htmlspecialchars($_POST['message']));
    $ip $_SERVER['REMOTE_ADDR'];

    $mail "[email protected]";
    $sub "Email from $name";
    $msg "Here's $name's email:
    Name: 
    $name
    Email: 
    $email
    IP: 
    $ip
    Subject: 
    $subject
    Message: 
    $message";
    $headers "From: $email";

    mail("$mail","$sub","$msg","$headers");

    echo 
    "Thanks, your form has been sent, we will reply within 24 hours!";
    }
    } else {
    echo 
    "<form method='post' action='$_SERVER[PHP_SELF]'>
    Name:<br>
    <input type='text' name='name' size='20'><br>
    Email:<br>
    <input type='text' name='email' size='20'><br>
    Subject:<br>
    <input type='text' name='subject' size='20'><br>
    Message:<br>
    <textarea name='message' cols='45' rows='6'></textarea><br>
    <input type='submit' name='send' value='Send'>
    </form>"
    ;
    }
    ?>

Page 1 of 3 123 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
  •