Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Is 1 button too much to ask?

Options
  • 20-01-2008 8:01am
    #1
    Registered Users Posts: 1,034 ✭✭✭


    I've googled for a while now and still can't find something uncomplicated enough for me to understand.

    Here's what I want:

    User enters their e-mail address and clicks "submit". They get a "thank you" page and I get an e-mail with their e-mail address so I can manually add them to a list, or they get added to an online database.

    It seems to be a lot less straightforward than I understood it to be.

    If anyone has any templates that I can use, or can point me somewhere that doesn't require a huge degree of .cgi or .php scripting knowledge, I would be most grateful.

    Thanks in advance guys and gals.


Comments

  • Closed Accounts Posts: 2,161 ✭✭✭steve-hosting36


    Basically, you need a simple formmail script - are you running on a Linux or Windows platform?


  • Registered Users Posts: 1,034 ✭✭✭Devon


    It's linux. Should have said. Doh!


  • Closed Accounts Posts: 2,161 ✭✭✭steve-hosting36


    Grab formmail from here: http://www.scriptarchive.com/download.cgi?s=formmail

    Drop it in your cgi-bin, adjust the settings in the script, as per the readme (basically,m set your email, etc), then point your form action at it, and you'll get emailed the contents of the form submissions.


  • Registered Users Posts: 1,034 ✭✭✭Devon


    It's as easy as that huh? :confused:

    I had already downloaded that and couldn't make sense of what to do. You say drop it in my "cgi" - I assume you mean the directory called "cgi-bin"?

    I've never done anything like this with cgi so it will take me a while to get used to how it functions.

    Thanks for the help though.


  • Closed Accounts Posts: 2,161 ✭✭✭steve-hosting36


    formmail is pretty simple to get running - where are you hosted? The hosting providers support should be able to get the script running for you...


  • Advertisement
  • Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭Sully


    Ah Steve, why not just point him to a simple PHP one instead of the CGI malrky.

    OP: Give me a PM with what you want asked on the form and ill put it together for you. No charge, and ill explain what to do with it. :)


  • Closed Accounts Posts: 2,161 ✭✭✭steve-hosting36


    Even a simple PHP is about as tough to config as 'good ole' formmail.cgi ;)


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Done this quickly up and havn't tested it. Use something similar myself.

    Its PHP and if you have SMTP properly set up on the local server this should work.
    Note: it will require PHP5 for the print <<<EOF bit AFAIK but that can easily be changed to work with PHP 4.x

    [php]<?php
    if (isset($_POST)
    {
    $email = $_POST;

    $normalemailaddress = "^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$";
    $emailcheck = eregi($normalemailaddress, $email);

    if (!$emailcheck)
    die("You have not specified a valid email format");

    $receiveremail = 'youremail@yourcompany.com';

    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: '.$email."\r\n";
    $message = '<html>
    <head>
    <title>Email Adder</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style>
    body{
    font-family: arial;
    font-size: 12px;
    }
    </style>
    </head>

    <body>
    <p>Hi,<br>
    A new email submited: '.$email.'</strong><br>
    </p>
    </body>
    </html>
    ';
    if (@mail($receiveremail,"A New Email Address",$message,$headers))
    {

    print "<p align=\"left\">Thanks for your message! We will receive it shortly.</p><br>";
    } else {
    print "<p><strong>We are sorry</strong>, the server is experiencing some difficulty at the moment.<br /> Please try again later or refresh the page.</p>";
    }
    }
    else
    {
    $thispage = $_SERVER;
    print <<<EOF

    <html>
    <head>
    <title>My Email Adder</title>
    </head>
    <body>
    Please enter your email address
    <form action="$thispage" method="post">
    <input name="emailaddress" type="text" />
    <input name="submit" type="submit" value="Add" />
    </form
    </body>
    </html>

    EOF;

    }

    ?>[/php]

    Hope Helps.


  • Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭Sully


    Web: Sorted it out for him :)

    Whats the modifcation to get that working on php4?


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Sully wrote: »
    Web: Sorted it out for him :)

    Whats the modifcation to get that working on php4?
    Cool stuff.

    As for the way around the print <<< - well I meant you would simply have closed the ?> tag before this and reopened after the HTML as i'm sure you are well familar with only you interpreted what i said incorrectly :)

    I do find print <<< quite handy though.


  • Advertisement
Advertisement