Configurable PHP form emailer

I'm looking suggestions for a drop-in PHP form emailer
script... something that I can either configure by using templates
that are unique to each form or some other method of per-form
configurability.
I'm using soupermail.pl now, but would like to move away from
it because it has issues with certain users who use AOL and have
Norton security products (they will receive errors when submitting
the form).
I do not want to write a generic form mailer from scratch, as
I am not comfortable with ensuring that it is safe from spammers...
I would like to find something that I can use from several forms on
my site. I do not need to write anything to a database, just be
able to email to variable destination email accounts. I do not want
to be able to upload or send attachments.
Thanks for any suggestions.

Hi there - read my article titled, "Validating your forms
with PHP" - here:
http://sourtea.com/articles.php
At the end of the article, I provide the full, free code to
do what you're
looking for.
HTH, take care.
Shane H
[email protected]
http://www.avenuedesigners.com
=============================================
Web Dev Articles, Photography, and more:
http://sourtea.com
=============================================
Proud GAWDS Member
http://www.gawds.org/showmember.php?memberid=1495
Delivering accessible websites to all ...
=============================================
"JillTW" <[email protected]> wrote in
message
news:eeebap$q71$[email protected]..
> I'm looking suggestions for a drop-in PHP form emailer
script... something
> that
> I can either configure by using templates that are
unique to each form or
> some
> other method of per-form configurability.
>
> I'm using soupermail.pl now, but would like to move away
from it because
> it
> has issues with certain users who use AOL and have
Norton security
> products
> (they will receive errors when submitting the form).
>
> I do not want to write a generic form mailer from
scratch, as I am not
> comfortable with ensuring that it is safe from
spammers... I would like to
> find
> something that I can use from several forms on my site.
I do not need to
> write
> anything to a database, just be able to email to
variable destination
> email
> accounts. I do not want to be able to upload or send
attachments.
>
> Thanks for any suggestions.
>

Similar Messages

  • PHP Form Emailing Fields But No Data

    Hello,
    I am running into a little problem with my PHP form script.  I am able to email my form and receive a message, however the message has no data, except for where I have check boxes.  Can anyone help me solve this dilemma?  Some of the code has been remove intentionally.
    I will post my code:
    <?php
    /* Email Variables */
    $emailSubject = ' Registration Form';
    $webMaster = 'de';
    /* Data Variables */
    $registrationname = $_POST['registrationname'];
    $registrationphone = $_POST['registrationphone'];
    $registrationemail = $_POST['registrationemail'];
    $registrationdistrict = $_POST['registrationdistrict'];
    $registrationposition = $_POST['registrationposition'];
    $onecredit = $_POST['onecredit'];
    $twocredit = $_POST['twocredit'];
    $threecredit = $_POST['threecredit'];
    $body = <<<EOD
    <br><hr><br>
    Name of Register: $registrationname <br>
    Day Time Phone Number: $registrationphone <br>
    Email Address of Register: $registrationemail <br>
    Name of School District: $registrationdistrict <br>
    Position/Job Title: $registrationposition <br>
    Register for 1 Credit: Learning to Use the easyCBM Assessment System: $onecredit <br>
    Register for 2 Credits: In-Depth Knowledge of the easyCBM Assessment System: $twocredit <br>
    Register for 3 Credits: Enroll in Both of the Above Options: $threecredit <br>
    EOD;
    $headers = "From: $email\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body,
    $headers);
    /* Results rendered as HTML */
    $theResults = <<<EOD
    <html>
    <head>
    <title>sent message</title>
    <meta http-equiv="refresh" content="6;URL=http://.html">
    <style type="text/css">
    <!--
    body {
    background-color: #D9D3A9;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 20px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    color: #000000;
    text-decoration: none;
    padding-top: 200px;
    margin-left: 200px;
    width: 800px;
    -->
    </style>
    </head>
    <div align="center">Thank you! Your request has been sent.
    You will return to the page in a few moments.</div>
    </div>
    </body>
    </html>
    EOD;
    echo "$theResults";
    ?>

    1) I would bring the line <cfoutput query="CheckUser"> lower down in the code, for example, just before the first table tag.
    2)These are probably mistakes
    <<table border="0" align="center" cellpadding="0" cellspacing="0">
    <input type="hidden" name="LogDate" value="Now()">
    I think they should be
    <table border="0" align="center" cellpadding="0" cellspacing="0">
    <input type="hidden" name="LogDate" value="#Now()#">
    3) You could revise the action page to:
    <cfif isDefined("form.logDate")>
    <cfinsert datasource="manna_premier" formfields="LogDate,TerritoryManager,Status,DSRName,ServiceName" tablename="TMStatusLog">
    <cflocation url="mp_order_form.cfm">
    </cfif>
    The table TMStatusLog must of course have columns LogDate, TerritoryManager, Status, DSRName and ServiceName.

  • Need to add senders email address into the subject header of my PHP form (somehow)

    Hello one and all,
    I have a PHP form which is working fine and sends our support team an email with the subject header 'Support'.
    I have been asked to fix this form to include the senders email address into the Subject header so that the support team can filter them easier and reply quicker.
    Any help would be very much appreciated indeed. The form code is below, let me know if you need the whole page.
    Thanks in advance,
    Bradley
    My current form PHP part looks like this: (and the HTML part is below in blue)
    <?php
        if($_GET["action"] == "email")
            $msg = "The following person need support:\n\n";
            $msg = $msg . "First Name: " . $_POST["FirstName"] . " " . $_POST["LastName"] . "\n";
            $msg = $msg . "Tel: " . $_POST["Tel"] . "\n";
            $msg = $msg . "Email: " . $_POST["FROM"] . "\n";
            $msg = $msg . "Support: " . $_POST["Support"] . "\n";
            $msg = $msg . "Model: " . $_POST["Model"] . "\n";
            $msg = $msg . "Comments: " . $_POST["Comments"] . "\n";
            $to ="[email protected]";
            $subject = "Support";
            $from = "From: " . $_POST["FROM"];
            mail($to, $subject, $msg, $emailFrom, $from);
            header("Location:support2.php");
    ?>
    and the HTML part of the fom is like this:
    <form id="form1" name="form1" method="post" action="support.php?action=email">
      <table width="700" border="0" cellspacing="10" cellpadding="10">
        <tr>
          <td valign="middle" class="formtext">*First name:</td>
          <td width="455" valign="middle"><label>
            <input name="FirstName" type="text" class="form-textbox" id="FirstName" />
          </label></td>
        </tr>
        <tr>
          <td valign="middle" class="formtext">*Last name:</td>
          <td valign="middle"><input name="LastName" type="text" class="form-textbox" id="LastName" /></td>
        </tr>
        <tr>
          <td valign="middle" class="formtext">*Email:</td>
          <td valign="middle"><input name="FROM" type="text" class="form-textbox" id="FROM" /></td>
        </tr>
        <tr>
          <td valign="middle" class="formtext">*Telephone:</td>
          <td valign="middle"><input name="Tel" type="text" class="form-textbox" id="Tel" /></td>
        </tr>
        <tr>
          <td valign="middle" class="formtext"> </td>
          <td valign="middle"> </td>
        </tr>
        <tr>
          <td valign="middle" class="formtext">*Support required:</td>
          <td valign="middle"><label>
            <select name="Support" class="form-dropdown" id="Support">
              <option selected="selected">Please select...</option>
              <option value="Connection Issues">Connection Issues</option>
              <option value="Technical Issues">Technical Issues</option>
              <option value="Furniture Faults">Furniture Faults</option>
              <option value="Other">Other</option>
            </select>
          </label></td>
        </tr>
        <tr>
          <td valign="middle" class="formtext">Chair model:</td>
          <td valign="middle"><input name="Model" type="text" class="form-textbox" id="Model" /></td>
        </tr>
        <tr>
          <td valign="middle" class="formtext">*Please describe your issue:</td>
          <td valign="middle"><textarea name="Comments" rows="5" class="form-textarea" id="Comments"></textarea></td>
        </tr>
        <tr>
          <td valign="middle" class="maintext"> </td>
          <td valign="middle" class="maintext"></td>
        </tr>
        <tr>
          <td valign="middle"> </td>
          <td valign="middle"><label>
            <input name="Submit" type="submit" class="form-submit-button" value="Submit" />
          </label></td>
        </tr>
      </table>
      </form>

    MurraySummers you sir, are an absolute legend! This worked perfect straight off the bat!
    I really apreciate your lightning fast reply!
    Thanks again.
    Bradley

  • Online php form (inserts) in pdf form and send via email

    So first hello all.
    There are 4 PDF Forms amd 4 php forms on a website.
    The user should be able to fill out the php form, click on send and the inserts from the user should be stored in the pdf form and send to an email adress.
    I know that there are 3rd party tools, the convert it to a image, draw the inserts and convert it back.
    But i want to know, how to do it with acrobat itself.
    Is there any way to put varaibles in the pdf where php can set (fill)
    If this is impossible:
    I have heard, that there is a server version from acrobat who can manage this.
    The information about this is rarly like i dont understand how much the costs are.
    First : price x (for the server software itself)   
    Second: price y (for every processed document)
    Many thanks in advance
    IT Technik Schiedt

    You cannot use Acrobat on a server in that manner. Acrobat is licensed for one user one system at a time.
    You can create and FDF file with the form field data and use that data to fill-in a PDF. You needd to create a unique PDF that could be added to an email and then deleted. You could also accumulate the data in a database.

  • Code issue in php form - submit button not sending email

    Created a form that was originally supposed to open up to 2 pages depending on what was clicked. Clear would send you to an error page, and submit would send you to a thank you page. Decided that was a waste and so did not create the html pages. BUT, wanted the form info for the contact page.
    Here is the issue: it will not submit when submit is clicked. It clears when you click clear, but there's no email coming from the site via submit.
    Do I need to edit the php form code if I don't want the other pages? I've looked at what I have but I don't see if there is a form error or anything here. Here is the code for anyone who wants to have a look. Thanks in advance.
    <?php
    // get posted data into local variables
    $EmailFrom = "EMAIL FROM WEP PAGE - CONTACT - ";
    $EmailTo = "[email protected]";
    $Subject = "EMAIL FROM jennylowhar.com - CONTACT -";
    $name = Trim(stripslashes($_POST['name']));
    $telephone = Trim(stripslashes($_POST['telephone']));
    $email = Trim(stripslashes($_POST['email']));
    $comments = Trim(stripslashes($_POST['comments']));
    // validation
    $validationOK=true;
    if (Trim($name)=="") $validationOK=false;
    if (Trim($email)=="") $validationOK=false;
    if (!$validationOK) {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
      exit;
    // prepare email body text
    $Body = "";
    $Body .= "name: ";
    $Body .= $name;
    $Body .= "\n";
    $Body .= "telephone: ";
    $Body .= $telephone;
    $Body .= "\n";
    $Body .= "email: ";
    $Body .= $email;
    $Body .= "\n";
    $Body .= "comments: ";
    $Body .= $comments;
    $Body .= "\n";
    // send email
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
    // redirect to success page
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.html\">";
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.php\">";
    ?>

    I'm confused by that, but I know this works.
    $fname=STRIPSLASHES($_POST['fname']);
    $lname=STRIPSLASHES($_POST['lname']);
    $title=STRIPSLASHES($_POST['title']);
    $company=STRIPSLASHES($_POST['company']);
    $street=STRIPSLASHES($_POST['street']);
    $town=STRIPSLASHES($_POST['town']);
    $zip=STRIPSLASHES($_POST['zip']);
    $phone=STRIPSLASHES($_POST['phone']);
    $fax=STRIPSLASHES($_POST['fax']);
    $county=STRIPSLASHES($_POST['county']);
    $phone=STRIPSLASHES($_POST['phone']);
    $email=STRIPSLASHES($_POST['email']);
    $comments=STRIPSLASHES($_POST['comments']);
    $date=STRIPSLASHES($_POST['date']);
    $time=STRIPSLASHES($_POST['time']);
    $location=STRIPSLASHES($_POST['location']);
    $from="$email";
    $to="putemailhere";
    $subject="Submission from Contact Form";
    $msg= "This is a submission from yoururl.com.\n\n"
    . "Clients Name: $fname . $lname \n"
    . "Title: $title\n"
    . "Company Name: $company\n"
    . "Street Address: $street\n"
    . "Town:$town\n"
    . "Zip: $zip\n"
    . "Telephone: $phone\n"
    . "Email Address: $email\n"
    . "Comments: $comments\n";
    mail($to, $subject, $msg, 'From:' .$from);
    PS, go back and edit your origial post and REMOVE your email.
    Gary

  • PHP forms submitted as an attachment rather than email?

    How do I get my PHP forms submitted as an attachment rather than email?
    Meaning, if I set up a form on my website and someone completes and submits it, how can I get the responses as an attachment rather than in email text?
    Much appreciated.
    G

    Hi Gunter
    I have spent so much time on this now.
    I have tried to convert the php to an attached .txt or .csv file.
    Learnt a lot but still can not seem to get the form data to be submitted as an attached file.
    Here are two of my attempts, please assist:
    <?php
    $email=$_REQUEST['email'];
    $firstName=$_REQUEST['firstName'];
    $lastName=$_REQUEST['lastName'];
    //The Attachment
    $cr = "\n";
    $data = "Email" . ',' . "First Name" . ',' . "Last Name" . $cr;
    $data .= "$email" . ',' . "$firstName" . ',' . "$lastName" . $cr;
    $fp = fopen('reservationTest.csv','a');
    fwrite($fp,$data);
    fclose($fp);
    // Mail to
    $email = "myemailaddress";
    //subject
    $subject = "Test Budget reservation";
    //Header
    $headers("Content-type: application/octet-stream");
    $headers("Content-Disposition: attachment; filename=reservationTest.csv");
    $headers("Pragma: no-cache");
    $headers("Expires: 0");
    //Message
    $message = "".
    "Email: $email" . "\n" .
    "First Name: $firstName" . "\n" .
    "Last Name: $lastName";
    mail($email, $subject, $message, $headers);
    ?>
    <html>
    <body>
    <table width="400" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <div align="center">Guperman Your Test Message Has Been Submitted</div>
    </td>
    </tr>
    </table>
    </body>
    </html>
    EOD;
    echo "$theResults";
    OR
    <?php
    /* subject and email variables */
    $email = $_POST['email'];
    $lastname = $_POST['lastname'];
    $firstname = $_POST['firstname'];
        $to = 'myemailaddress';
        $emailSubject = 'Test Form';
        $headers = "From: $email\n";
    $message = "A new reservation test.\n
    Last Name</b>: $lastname
    Name</b>: $firstname
    Email</b>: $email
        mail($to,$emailSubject,$headers,$message);
    //open the file and choose the mode
    $fh = fopen("reservationTest.txt", "a");
    fwrite($fh, $email);
    //close the file
    fclose($fh);
    ?>
    <html>
    <body>
    <table width="400" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <div align="center">Guperman Your Test Message Has Been Submitted</div>
    </td>
    </tr>
    </table>
    </body>
    </html>
    On both accounts when I test these files I get the following types of messages.
    Warning:  fopen(reservationTest.csv) [function.fopen]: failed to open stream: Permission denied in \\HOSTING\DFS\20\1\9\1\2028751191\user\sites\mywebsite.com\www\reservationTest.php on line 11
    Warning:  fwrite(): supplied argument is not a valid stream resource in \\HOSTING\DFS\20\1\9\1\2028751191\user\sites\mywebsite.com\www\reservationTest.php on line 12
    Warning:  fclose(): supplied argument is not a valid stream resource in \\HOSTING\DFS\20\1\9\1\2028751191\user\sites\mywebsite.com\www\reservationTest.php on line 13
    Fatal error:  Function name must be a string in \\HOSTING\DFS\20\1\9\1\2028751191\user\sites\mywebsite.com\www\reservationTest.php on line 22
    And then to give the .php files permission I left click on the already uploaded files and try and set the permission to 777, but then I get a response like: Setting Access Properties failed for:
    Your assistance is much appreciated. Regards

  • When I use a simple form, I get this error message "Form communication is configured with an email address of..." and the person's email address did not get sent a message

    I was unable to use the simple form to which I should simply put the email address of the person to whom the form should be sent to.  I get this error message:
    As a result of this, this person did not get any filled form response.  Where did I go wrong and how can fix this.
    Second question, I am using GoDaddy.com account and they have their own set of php form.  If I want to use their php form, where in Adobe muse, can I insert their php?

    Hello Tonchee
    If you are seeing an Apple ID that is not yours, then you have purchased content on your iPad that is tied to that Apple ID. You would need to know that password or remove the content that is associated with that Apple ID.
    Using your Apple ID for Apple services
    http://support.apple.com/kb/ht4895
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • Need my PHP form to send $user email with attachment

    Hi guys,
    I have a PHP form which submits the result to me and also sends the $user a 'thank you' email, which works fine.
    What I want to do is for the email that the $user is sent to have an attachment (probably PDF).
    Does anyone know if this is possible and if so, how I could edit my code?
    My code looks like:
    <?php
    $to = "[email protected]";
    $subject = "Form Submission";
    $email=$_POST['email'] . "\r\n";
    $message = $headers;
    $message .= "Name: " . $_POST["firstname"] . "\r\n";
    $message .= "Surname: " . $_POST["surname"] . "\r\n";
    $message .= "Company: " . $_POST["company"] . "\r\n";
    $message .= "Address: " . $_POST["address1"] . ", " . $_POST["address2"] . ", " . $_POST["address3"] . ", " . $_POST["postcode"] . "\r\n";
    $message .= "E-mail: " . $_POST["email"] . "\r\n";
    $message .= "E-mail Confirm: " . $_POST["email_confirm"] . "\r\n";
    $message .= "Telephone: " . $_POST["tel"] . "\r\n";
    $message .= "Spend: " . $_POST["aams"] . "\r\n";
    $message .= "Mailing List: " . $_REQUEST['mailinglist'] . "\r\n";
    $url = stripslashes($_POST["url"]);
    if (!empty($url)) {
    header( 'Location: http://www.google.com' );
    exit();
    mail($to, $subject, $message, $headers);
    header( 'Location: http://www.mydomain.co.uk/sent.php' ) ;
    $user = "$email";
    $usersubject = "Thank you for registering";
    $userheaders = "From: [email protected]\n";
    $usermessage = "Dear " . $_POST["firstname"] . ",
    Thank you for filling out my online form. Please see the attached document.
    From me
    www.mydomain.com
    mail($user,$usersubject,$usermessage,$userheaders);
    ?>
    Many thanks and I hope to hear from you.
    SM

    thanks guys...
    i added the line...
    $userattachment = chunk_split(base64_encode(file_get_contents('attachment.pdf')));
    ...but, although the 'user' email still comes through there is no attachment.
    as you can probably tell i am useless with php so would appreciated any further help.
    many thanks,
    sm

  • PHP Form mail

    I used this script
    http://www.visibilityinherit.com/code/php-form-validation.php
    to produce a form and everything worked fine on my site, which I
    was using for testing. When I transferred over to the client's site
    it doesn't send the email. The error and thank you messages work,
    but no email. As I have heard that some hosts block some php files
    with the name 'formmail' I called it something else.
    I have checked and rechecked all the data and only my email
    address and the URLs for the error and thank you pages had to be
    changed, my email is correct, but still not email.
    Any ideas as to what is happening and how I can get around it
    please?
    Rosalind

    I have been sent the following information and code, but have
    not succeeded in working out where to add it. The code I am using
    is underneath. Many thanks
    - to send emails through our servers you must comply with one
    of the following rules
    a. The sending email must be from your domain
    b. The receiving email must be from your domain
    This account could/should be [email protected]
    - To avoid a wrong use of our scripts by spammers you must
    had a line before you call the “mail” functionality
    ini_set("sendmail_from", " [email protected] ");
    - Please add to the email send code a functionality
    “-f” in the fifth parameter of the function send mail
    - This is the simple configuration of sending emails in php
    <?php
    ini_set("sendmail_from", [email protected]);
    mail($email_to, $email_subject, $email_message, $headers,
    '-f'[email protected]);
    ?>
    my php code is
    <?php
    // Input Your Personal Information Here
    $mailto = '[email protected]' ;
    $from = "FormosaParadise.com" ;
    $formurl = "
    http://formosaparadise.com/correios.php"
    $errorurl = "
    http://formosaparadise.com/formmailerror.php"
    $thankyouurl = "
    http://formosaparadise.com/thankyou.php"
    // End Edit
    // prevent browser cache
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "
    GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    function remove_headers($string) {
    $headers = array(
    "/to\:/i",
    "/from\:/i",
    "/bcc\:/i",
    "/cc\:/i",
    "/Content\-Transfer\-Encoding\:/i",
    "/Content\-Type\:/i",
    "/Mime\-Version\:/i"
    if (preg_replace($headers, '', $string) == $string) {
    return $string;
    } else {
    die('You think Im spammy? Spammy how? Spammy like a clown,
    spammy?');
    $uself = 0;
    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" :
    "\n" ;
    if (!isset($_POST['email'])) {
    header( "Location: $errorurl" );
    exit ;
    // Input Your Personal Information Here
    $name = remove_headers($_POST['name']);
    $email = remove_headers($_POST['email']);
    $phone = remove_headers($_POST['phone']);
    $comments = remove_headers($_POST['comments']);
    $http_referrer = getenv( "HTTP_REFERER" );
    // End Edit
    if
    (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i",$email))
    header( "Location: $errorurl" );
    exit ;
    // Input Your Personal Information Here
    if (empty($name) || empty($email) || empty($phone)
    ||empty($comments)) {
    header( "Location: $errorurl" );
    exit ;
    // End Edit
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    exit ;
    if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
    // sets max amount of characters in comments area (edit as
    nesesary)
    if (strlen($comments) > 1250) {
    $comments=substr($comments, 0, 1250).'...';
    // End Edit
    $message =
    "This message was sent from:\n" .
    "$http_referrer\n\n" .
    // Input Your Personal Information Here
    "Name: $name\n\n" .
    "Email: $email\n\n" .
    "Phone No: $phone\n\n" .
    "Comments: $comments\n\n" .
    "\n\n------------------------------------------------------------\n"
    // End Edit
    mail($mailto, $from, $message,
    "From: \"$name\" <$email>" . $headersep . "Reply-To:
    \"$name\" <$email>" . $headersep );
    header( "Location: $thankyouurl" );
    exit ;
    ?>

  • Need help with PHP form with checkboxes, radio buttons and file attachment

    Hi guys,
    I'm having a nightmare with this PHP form where a user can fill it in, attach a doc/pdf and submit. After trying to sort it out with previous code I've used, I've stripped it out and think I should just start again in the hope you geniuses can help!
    Here is the HTML of contact.php:
    <form action="" method="post" name="contact" id="contact">
        <p>Job Title:*<br />
        <input name="position" type="text" /></p>
        <p>Nationality:*<br />
        <select name="nationality">
          <option value="">-- select one --</option>
          <option value="Afghan">Afghan</option>
          <option value="Albanian">Albanian</option>
          <option value="Algerian">Algerian</option>
          <option value="Zambian">Zambian</option>
          <option value="Zimbabwean">Zimbabwean</option>
        </select>
        </p>
        <p>Which country are you currently living in?*<br />
        <select name="country">
        <option value="">-- select one --</option>
        <option value="United Kingdom">United Kingdom</option>
        <option value="Afghanistan">Afghanistan</option>
        <option value="Africa">Africa</option>
        <option value="Zambia">Zambia</option>
        <option value="Zimbabwe">Zimbabwe</option>
        </select>
        </p>
        <label class="radio" for="checkRight">Yes/No question?</label><br />
        <input class="radio" type="radio" name="right" value="Yes" /> Yes
        <input class="radio" type="radio" name="right" value="No" /> No
        <input class="radio" type="radio" name="right" value="N/A" /> Not applicable
        <p>Yes/No question?<br />
        <select name="continue">
        <option value="">-- select one --</option>
        <option value="Yes">Yes</option>
        <option value="No">No</option>
        </select>
        </p>
        <p>Select your resorts:<br />
        Resort 1<input name="res1" type="checkbox" value="Resort 1" />
        Resort 2<input name="res2" type="checkbox" value="Resort 2" />
        Resort 3<input name="res3" type="checkbox" value="Resort 3" />
        Resort 4<input name="res4" type="checkbox" value="Resort 4" />
        Resort 5<input name="res5" type="checkbox" value="Resort 5" />
        Resort 6<input name="res6" type="checkbox" value="Resort 6" />   
        </p>
        <p>Don't send form unless this is checked:* <input type="checkbox" name="parttime" value="Yes" /></p>
        <p>Date of arrival: <input name="arrive" id="datepick" /><br />
        Date of departure: <input name="depart" id="datepick2" /></p>
        <script type="text/javascript" src="assets/scripts/datepickr/datepickr.js"></script>
        <link href="assets/scripts/datepickr/datepickr.css" rel="stylesheet">
        <script type="text/javascript">
        new datepickr('datepick');
        new datepickr('datepick2', {
        </script>
        <p>Name:*<br />
        <input name="name" type="text" /></p>
        <p>E-mail:*<br />
        <input name="email" type="text" /></p>
        <p>Telephone:*<br />
        <input name="telephone" type="text" class="ctextField" /></p>
        <p>Upload CV (Word of PDF formats only):<br />
        <input type="file" name="cv" class="textfield"></p>
        <p><input name="submit" value="Submit Enquiry" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
    </form>
    By the way, the date boxes work so excuse the Javascript in there!
    To prevent SPAM I've used a trick where there's a hidden URL field which must be left blank for the form to submit which you can see in the PHP.
    Below is where I'm at with the PHP which is placed above the header of contact.php...
    <?php
    if (array_key_exists('submit', $_POST)) {
        $position = $_POST['position'];
        $arrive = $_POST['arrive'];
        $nationality = $_POST['nationality'];
        $parttime = $_POST['parttime'];
        $depart = $_POST['depart'];
        $name = $_POST['name'];
        $email = $_POST['email'];
        $telephone = $_POST['telephone'];
    $to = "[email protected]";
    $subject = "Recruitment Application";
    $message = $headers;
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "E-mail: " . $_POST["email"] . "\r\n";
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $headers .= 'From: My Website <[email protected]>' . "\r\n";
    $message= "
    $url = stripslashes($_POST["url"]);
    if (!empty($url)) {
    header( 'Location: http://www.go-away-spam-robots.com' );
    exit();
    if (!isset($warning)) {
    mail($to, $subject, $message, $headers);
    header( 'Location: http://www.mywebsite.co.uk/sent.php' );
    ?>
    I would like to make pretty much all the field compulsory so if a field is left empty (other than the hidden URL field), a warning message is displayed next to that field.
    Also I would like the file upload field to attach to the email that is sent to me and have the results come through to me in a table format.
    Can anyone help me get my form working?
    Thank you and I hope to hear from you!
    SM

    Hi Nancy,
    Great stuff, thank you for the reply.
    I've managed to get the Formm@iler working and running as I need it to.
    The only thing I'm struggling with is when the user clicks submit, they are taken to a page of whatever results the form returned but it is just a white background with Times New Roman text.
    How can I have it so the user is taken to the form results in the websites' page layout?
    I tried sending them to a generic 'thank you' page by adding the following code but it just took them there whatever the results of the form so that's no good...! I have a feeling it's a bit more complicated than that...
    header( 'Location: http://www.nofussbus.co.uk/test/sent.php' );
    Thank you for your help!

  • PHP form layout issue

    Hi all, I have a basic php form on a page, it works great,
    and my email recieves the content as required, BUT, when the form
    submits and the page shows the forms content, it throws out my
    layout ocmpletely. My white maincontent dissapears, and the footer
    div is all misaligned, my code is attached. Can anyone help please?
    many thanks

    On Thu, 7 Feb 2008 16:34:22 +0000 (UTC), "simbull"
    <[email protected]> wrote:
    >Thanks for the response gary, I have tried that (and just
    did again), that
    >means the user is not presented with the php output,
    which I do want them to be
    >ideally. Anyhow, that aside, it still throws my layout
    out..?
    Impossible to give you a better answer without knowing what
    you want to
    accomplish, but it sounds like your layout might be too
    fragile.
    Gary

  • Issue: Flash radio buttons & Php form

    I have a flash form which all of the fields are sending
    correctly
    through the php code. The flash radio buttons I added with
    the
    groupname == topic, doesnt send with the rest of the
    information that is being sent to the email. My question is
    how do I get
    the flash radio button info to submit with the rest of the
    form.
    The code for the send button on my flash file:
    on (release) {
    // send variables in form movieclip (the textfields)
    // to email PHP page which will send the mail
    form.loadVariables("form.php", "POST");
    ===============================================
    ===============================================
    Form.php:
    <?php
    $to = "[email protected]";
    $subject = "Contact Page Information for Today";
    $headers = "From: " . $_POST["name"];
    $headers .= "<" . $_POST["email"] . ">\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $headers .= "Return-Path: " . $_POST["email"];
    $message .= "\n\n";
    $message .= "Subject: " . $_POST["topic"] . "\r\n";
    $message .= "Email: " . $_POST["email"] . "\r\n";
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "Address: " . $_POST["address"] . "\r\n";
    $message .= "City: " . $_POST["city"] . "\r\n";
    $message .= "State: " . $_POST["state"] . "\r\n";
    $message .= "Zip Code: " . $_POST["zip"] . "\r\n";
    $message .= "Phone: " . $_POST["phone"] . "\r\n\n";
    $message .= "Message: " . $_POST["message"] . "\r\n";
    mail($to, $subject, $message, $headers);
    ?>
    Text

    Do you mean like this:
    <?php
    var topic;
    var listenerObject:Object = new Object();
    listenerObject.click = function(eventObj:Object) {
    topic = eventObj.target.data;
    trace(topic)
    groupTopic1_rb.addEventListener("click", listenerObject);
    groupTopic2_rb.addEventListener("click", listenerObject);
    groupTopic3_rb.addEventListener("click", listenerObject);
    groupTopic4_rb.addEventListener("click", listenerObject);
    groupTopic5_rb.addEventListener("click", listenerObject);
    groupTopic6_rb.addEventListener("click", listenerObject);
    groupTopic7_rb.addEventListener("click", listenerObject);
    groupTopic8_rb.addEventListener("click", listenerObject);
    groupTopic9_rb.addEventListener("click", listenerObject);
    groupTopic10_rb.addEventListener("click", listenerObject);
    groupTopic11_rb.addEventListener("click", listenerObject);
    groupTopic12_rb.addEventListener("click", listenerObject);
    groupTopic13_rb.addEventListener("click", listenerObject);
    groupTopic14_rb.addEventListener("click", listenerObject);
    $to = "[email protected]";
    $subject = "Contact Page Information for Hope Today";
    $headers = "From: " . $_POST["name"];
    $headers .= "<" . $_POST["email"] . ">\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $headers .= "Return-Path: " . $_POST["email"];
    $message .= "\n\n";
    $message .= "Subject: " . $_POST["topic"] . "\r\n";
    $message .= "Email: " . $_POST["email"] . "\r\n";
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "Address: " . $_POST["address"] . "\r\n";
    $message .= "City: " . $_POST["city"] . "\r\n";
    $message .= "State: " . $_POST["state"] . "\r\n";
    $message .= "Zip Code: " . $_POST["zip"] . "\r\n";
    $message .= "Phone: " . $_POST["phone"] . "\r\n\n";
    $message .= "Message: " . $_POST["message"] . "\r\n";
    mail($to, $subject, $message, $headers);
    ?>

  • Can you auto-attach files in a PHP form?

    Hi there,
    Have been looking over everywhere for a solution to my problem. I am going to try and be as clear as I can about the problem.
    I have had some experience making simple PHP forms that let the user put their name, email, subject and body text and send it in an email using the form.
    But for a project I am currently undertaking - the client has requested a form that will pre-attach a particular document to the email when it is sent. All the user has to do is input the email address of the adressee and their name/email address and all the other fields are custom made (i.e. subject, body text) - and the email will be sent to the selected recepient with the file already attached.
    I was envisaging the PHP script would collect the reference for a file that is already sitting on the web server and attach it in the function.
    Is there anyway to do this? Because if it isn't I may as well tell the client to go and use outlook - because the web form will really have no purpose.
    Thanks in advance

    Hi have proceeded along the path of inserting links
    into PHP generated email but I am having trouble in outputting the body message in HTML - All I get out
    in the output email is the HTML tags with the text (plain text).
    Did some research and found out that I have to determine the content type/charset.
    I have tried to do this in my PHP but to no avail. Also I am not getting the email or name of the sender in the email that is generated....
    Anyway, there is the PHP code (and it's not that tight but it works):
    AND SOME DEFAULT TEXT THAT WILL CONTAIN LINKS TO NECESSARY FILES TO DOWNLOAD:
    link to PDF '.$field_message; $headers = 'From: '.$cf_yremail."\r\n"; $headers .= 'Reply-To: '.$cf_yremail."\r\n"; /* If your e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $mail_to)) { ?>
    Any help on this would be much appreciated....
    Thanks

  • Adobe 9 Pro Forms-email results

    I have adobe 9 pro and am making an electronic form. I would like when the user hits submit for it to email an address. My issue is I can't have it be an attachment, is there any way to configure the form to email the field names with the input?

    You can have then submit the .xml (information from the form fields only) then import it into the original form on your end but, it will still be an attachment.
    Have you considered creating a web form that will generate an email to you that contains all the information from the form fields and nothing else?
    Seems to me that having something like that on your company intranet would be best.

  • Form Email and Insert to DB

    I'm trying to get a form both - email and insert into a database the form information.  Below, you can see the code I am using.
    Here is my setup:
    1. I have a form where the action is a file called formmail.php
    2. This file inserts the data into a database and then includes another file called phpmail.php
    3. phpmail.php first looks in a file called zipcodes.php where I've set a number of arrays for various possible zipcodes.
    4. phpmail.php then emails the form data to the email addresses associated with those zipcodes.
    Without the formmail.php step - it works perfectly.
    With the formmail.php step - it inserts it into a database, checks if the email address is formatted correctly, but does not email anyone.
    Do you know why?   Below is the code for the various files:
    formail.php
    <?php
    $con = mysql_connect("localhost","user","password");
    if (!$con)
    die('Could not connect: ' . mysql_error());
    mysql_select_db("phtsystem", $con);
    $sql="INSERT INTO leads (firstname, lastname, address, city, `state`, zip, phone, email, comments, reason) VALUES ('$_POST[name2]','$_POST[last_name]','$_POST[address]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[phone2]','$_POST[email]','$_POST[comments]','$_POST[reason]')";
    if (!mysql_query($sql,$con))
    die('Error: ' . mysql_error());
    include "phpmail.php";
    ?>
    phpmail.php
    <?php
    include("zipcodes.php");
    $zip=$_POST["zip"];
              if (in_array($zip, $Nashville)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
              }elseif (in_array($zip, $Knoxville)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
              }elseif (in_array($zip, $Huntsville)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
              }elseif (in_array($zip, $Florida)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
              }elseif (in_array($zip, $Georgia)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
              }elseif (in_array($zip, $SouthCarolina)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
              }elseif (in_array($zip, $NorthCarolina)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
              }elseif (in_array($zip, $Pennsylvania)) {
    $my_email = "[email protected], [email protected], [email protected]";
              }elseif (in_array($zip, $Maryland)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
               }elseif (in_array($zip, $Virginia)) {
    $my_email = "[email protected], [email protected], [email protected], [email protected]";
               }elseif (in_array($zip, $Texas)) {
    $my_email = "[email protected], [email protected], [email protected]";
    } else { $my_email = "[email protected], [email protected], [email protected]";
    $continue = "/";
    $errors = array();
    if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}
    function recursive_array_check_header($element_value)
    global $set;
    if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i",$element_value)){$set = 1;}}
    else
    foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}
    recursive_array_check_header($_REQUEST);
    if($set){$errors[] = "You cannot send an email header";}
    unset($set);
    if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
    if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}
    $_REQUEST['email'] = trim($_REQUEST['email']);
    if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}
    if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
    function recursive_array_check_blank($element_value)
    global $set;
    if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
    else
    foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
    recursive_array_check_blank($_REQUEST);
    if(!$set){$errors[] = "You cannot send a blank form";}
    unset($set);
    if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}
    if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}
    function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
    $message = build_message($_REQUEST) . "This email is from the website.  If it doesn't say specifically what the person is contacting us about, it is most likely a sales lead.";
    $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";
    $message = stripslashes($message);
    $subject = "New Lead from PHT.com";
    $headers = "From: " . $_REQUEST['email'];
    mail($my_email,$subject,$message,$headers);
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Dreamweaver Tutorial - Contact Form</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-28969997-1']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    </script>
    </head>
    <body bgcolor="#ffffff" text="#000000">
    <div>
    <center>
    <b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b>
    <br>Your message has been sent
    <p><a href="<?php print $continue; ?>">Click here to continue</a></p>
    </center>
    </div>
    </body>
    </html>
    zipcodes.php
    <?php
    $Nashville = array (37010, 37027, 37040, 37055, 37067, 37075, 37088, 37121, 37133, 37152, 37179, 37201, 37209, 37217, 37228, 37238, 37246, 37015, 37034, 37048, 37063, 37071, 37082, 37115, 37129, 37141, 37167, 37186, 37205, 37213, 37221, 37234, 37242, 37250, 38487, 37011, 37029, 37041, 37056, 37068, 37076, 37089, 37122, 37135, 37153, 37180, 37202, 37210, 37218, 37229, 37239, 37247, 37022, 37035, 37049, 37064, 37072, 37085, 37116, 37130, 37143, 37171, 37187, 37206, 37214, 37222, 37235, 37243, 38401, 37013, 37031, 37043, 37060, 37069, 37077, 37090, 37127, 37136, 37155, 37181, 37203, 37211, 37219, 37230, 37240, 37248, 37024, 37036, 37051, 37065, 37073, 37086, 37118, 37131, 37146, 37172, 37188, 37207, 37215, 37224, 37236, 37244, 38476, 37014, 37032, 37046, 37062, 37070, 37080, 37098, 37128, 37138, 37165, 37184, 37204, 37212, 37220, 37232, 37241, 37249, 37025, 37037, 37052, 37066, 37074, 37087, 37119, 37132, 37148, 37174, 37189, 37208, 37216, 37227, 37237, 37245, 38482);
    ?>
    <?php
    $Knoxville=array(37354, 37709, 37717, 37726, 37737, 37755, 37763, 37770, 37777, 37803, 37819, 37830, 37842, 37849, 37865, 37874, 37886, 37901, 37914, 37918, 37922, 37928, 37932, 37940, 37996, 38504, 37381, 37710, 37719, 37729, 37742, 37756, 37764, 37771, 37779, 37804, 37826, 37831, 37845, 37852, 37866, 37878, 37887, 37902, 37915, 37919, 37923, 37929, 37933, 37950, 37997, 38557, 37701, 37714, 37721, 37732, 37748, 37757, 37766, 37772, 37801, 37806, 37828, 37840, 37846, 37853, 37871, 37882, 37892, 37909, 37916, 37920, 37924, 37930, 37938, 37990, 37998, 38558, 37705, 37716, 37723, 37733, 37754, 37762, 37769, 37774, 37802, 37807, 37829, 37841, 37847, 37854, 37872, 37885, 37893, 37912, 37917, 37921, 37927, 37931, 37939, 37995, 37999);
    ?>
    etc...
    Message was edited by: Drymetal

    Scratch that.  It does work perfectly.   It just took the stupid server 20 minutes to send the emails. 

Maybe you are looking for