Jump to content

Which is the easiest way to setup an simple contact form?


tires
 Share

Recommended Posts

Hi!

I found several modules and older descriptions in this forum to set up contactforms.

But which is the easiest way to get a small, nice contact form?

What is your recommendation?

Thanks a lot!

Link to comment
Share on other sites

It's difficult to give a recommendation because:

  1. We don't know what your needs (for the form) are
  2. We don't know exactly what other 'modules and descriptions' you've looked at already. We might just refer you back to one of them
  3. We don't know what you mean by easiest
  4. We don't know what is a small, nice contact form (nice: are you talking about CSS here? small: number of fields?)
  5. We don't know how you wish to capture and store the form information (in a field, in some page?)

OK, maybe it's just me who doesn't know these things :-). Your question is a bit vague. If possible tell us what exactly what you've already considered and what your needs are. Having said all that, any HTML form can be used as a ProcessWire form. You just need that and some template file and you are done :-)

  • Like 3
Link to comment
Share on other sites

The real question is, why you want to do this with module? Creating a simple contact form is easy.

<?php$action=$_REQUEST['action'];
if ($action=="") /* display the contact form */ { ?>
    <form  action="" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="action" value="submit">
    Your name:<br>
    <input name="name" type="text" value="" size="30"/><br>
    Your email:<br>
    <input name="email" type="text" value="" size="30"/><br>
    Your message:<br>
    <textarea name="message" rows="7" cols="30"></textarea><br>
    <input type="submit" value="Send email"/>
    </form>
    <?php
    } else /* send the submitted data */ {
    $name=$_REQUEST['name'];
    $email=$_REQUEST['email'];
    $message=$_REQUEST['message'];
    if (($name=="")||($email=="")||($message==""))
        {
        echo "All fields are required, please fill <a href=\"\">the form</a> again.";
        }
    else{
        $from="From: $name<$email>\r\nReturn-path: $email";
        $subject="Message sent using your contact form";
        mail("info@tewdin.com", $subject, $message, $from);
        echo "Email sent!";
        }
    }
?>
  • Like 1
Link to comment
Share on other sites

@tewdin,

Easy, yes - but not that easy. Please add input sanitisation and return value checks to your code posted above. I think you should also be getting the values from Post input, not from request input. If you have live code like the example you posted, you should probably revise it.

  • Like 8
Link to comment
Share on other sites

  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...