Jump to content
tires

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

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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

While I agree with what Kongondo has posted above, easiest method for just about any form-related need is usually FormBuilder. FormBuilder is a commercial module, and if that's a problem (and you really just need a very simple contact form) I'd suggest taking a look at Simple Contact Form by Bea.

  • Like 3

Share this post


Link to post
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

Share this post


Link to post
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 7

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...