Php email form

I'm sending a php form to an email address. The form does
send to my email and a message sent page is working for the user
filling in the form. However, I need to put the name, address, and
phone number included with the message that is sent to the e-mail.
This is the code that I am using:
<?php
$to = "[email protected]";
$subject = $_POST['subject'];
$body = $_POST['body'];
$headers = "From: [email protected]" .
$_POST['[email protected]'] . "\n";
mail($to,$subject,$body,$headers);
?>
I've tried putting $name = $_POST['name']; in the code, put
it doesn't seem to work. Is something like this possible. If so,
where do I add the code so I can include more information on the
form (name, address and phone number)?
Thanks for any help you can give me.

A simpler way would be to just use successive concatenation
rather than
heredoc, at least I think. Use this -
> $reply_message_subject = $_POST['subject'];//Subject of
new message from
> form
> $reply_message_body = $_POST['body'];//Body of new
message from form add
> all
> the text you want and links
Then use this -
$reply_message_body .= "\n\rName = ".$_POST['name'];
$reply_message_body .= "\n\rnickname = ".$_POST['nickname'];
$reply_message_body .= "\n\rdog-name = ".$_POST['dog-name'];
etc., etc., etc.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"MikeL7" <[email protected]> wrote in
message
news:f8elib$p93$[email protected]..
> The heredoc MAIL function is what you want here is one i
made from your
> info:
> i am not sure about your mailheaders line, sending an
email from yourself
> to
> yourself, i guess with the info on the form, but try
this:
>
> $to = "[email protected]";
> $reply_message_subject = $_POST['subject'];//Subject of
new message from
> form
> $reply_message_body = $_POST['body'];//Body of new
message from form add
> all
> the text you want and links
> $config_mailheaders = "From: [email protected]";
>
> //this is the actual email sent
> $reply_body=<<<_MAIL_
>
http://adobe.com/
> so you can see this is where you put more info
>
http://google.com/
> $reply_message_body
> thanks for filling out the form
>
>
> _MAIL_;
> //end actual email
>
>
> mail($to, $reply_subject, $reply_body,
$config_mailheaders);//Send email
>
>

Similar Messages

  • PHP Email Form is not Emailing

    HI,
    I made a PHP email form and i was wondering if i did it
    correct. I try to send a email but for some reason it wont work
    here is the PHP code:
    <?php
    $emailSubject = 'Computer Question!';
    $webMaster = '[email protected]';
    $nameField = $_POST ['name'];
    $phoneField = $_POST ['phone'];
    $emailField = $_POST ['email'];
    $questionField = $_POST ['question'];
    $body = <<<EOD
    <br><hr><br>
    Name: $name <br>
    Phone: $phone <br>
    Email: $email <br>
    Question: $question <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
    ?>
    Here is the Email form:
    :<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <form id="form1" name="form1" method="post"
    action="Contact form 505 test 2.php">
    <table width="70%" border="1" cellpadding="6">
    <tr>
    <th width="16%" scope="col"><div align="right">
    <label for="name">Name:</label>
    </div></th>
    <th width="84%" scope="col"><div align="left">
    <input name="name" type="text" id="name" size="35"
    maxlength="60" />
    </div></th>
    </tr>
    <tr>
    <th scope="row"><div align="right">
    <label for="phone ">Phone Number</label>
    </div></th>
    <td><div align="left">
    <input name="phone " type="text" id="phone " size="35"
    maxlength="13" />
    </div></td>
    </tr>
    <tr>
    <th scope="row"><div align="right">
    <label for="email">Email:</label>
    </div></th>
    <td><div align="left">
    <input name="email" type="text" id="email" size="35"
    maxlength="40" />
    </div></td>
    </tr>
    <tr>
    <th scope="row"><div align="right">
    <label for="question">Question:</label>
    </div></th>
    <td><div align="left">
    <textarea name="question" cols="26" rows="8"
    id="question"></textarea>
    </div></td>
    </tr>
    <tr>
    <th scope="row"> </th>
    <td><label for="Send Email"></label>
    <input type="submit" name="Send Email" id="Send Email"
    value="Submit" /></td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    Any help would be appreciated!
    thanks

    .oO(jumpman310)
    > I made a PHP email form and i was wondering if i did it
    correct. I try to send
    >a email but for some reason it wont work here is the PHP
    code:
    Next time please be more specific. "won't work" isn't really
    helpful.
    Anyway, the first thing to fix is the error reporting on your
    testing
    server, obviously it's not configured properly. In your
    php.ini these
    directives have to be set:
    error_reporting = E_ALL|E_STRICT
    display_errors = on
    You should get some notices from your script. After fixing
    those issues,
    you should also read about header injection and how to
    prevent it. Your
    script is vulnerable and can be abused for sending spam. Also
    consider
    to use a class like PHPMailer to make things more secure and
    convenient.
    Some further notes about your form markup:
    * It's very good that you make use of labels for your form
    controls, but
    in some cases the IDs of these controls contain spaces, which
    is not
    allowed.
    * You don't really need a label for a submit button.
    * Consider to drop all those div elements in the table
    headers - you
    don't need them. Use CSS to style the labels the way you
    want, e.g.
    form th {text-align: right}
    I also use this:
    label:hover {outline: 1px dotted #666}
    * Check the markup of the "Name" row. The 'scope' attribute
    is incorrect
    and the form control should be inside a 'td', not a 'th'.
    Micha

  • PHP email form checkbox values?

    Hello,
    I'm creating a php email form which part of it consists of a few checkboxes that I need to get the values of. My php knowledge isn't that great therefore I used a tutorial to successfully create the bulk of the form.
    I currently have 7 checkboxes set up as such:
    <input type="checkbox" id="grade_5" name="grade[]" value="Grade 5" />
    Each of these are named "grade[]" to be stored in an array called "grade".
    I know that the values are successfully stored in the array as they show up in the browser when I echo the array.
    $grade = $_POST['grade'];
    $N = count($grade);
    for($i=0; $i < $N; $i++) {
         echo($grade[$i] . " ");
    So, the part I am having trouble with is getting the values to show up in the body of the email.
    $body = "
    Grade Level(s): $grade
    All that is returned in this case is the word "Array" instead of the desired checked grade values.
    Any help is much appreciated! Thank you in advance!
    *Note: All other values (textboxes, selection dropdowns, etc.) are already successfully sent to the email.

    danedmonds wrote:
     All that is returned in this case is the word "Array" instead of the desired checked grade values.
    That's because $grade is an array. If you want to access the values, you need to use a loop. Alternatively, use implode() to turn it into a comma-separated string, like this:
    $grade = implode(', ', $grade);

  • Need help adapting David Powers PHP email form script please!

    Hi all,
    I'm fairly inexperienced with PHP and I'm trying to adapt the David Powers email form script from THE ESSENTIAL GUIDE TO DREAMWEAVER CS4 WITH CSS, AJAX, AND PHP.
    I've created a basic form so that visitors to the site can request a telephone call back from the site owner. The form asks the visitor for their name, telephone number and to select a time of day suitable for the telephone call to be made using radio buttons selecting between morning and afternoon.
    I'd like to achieve my goal with minimal validation error messages and would like to redirect to another page when a message is sent successfully. It is also important that in the spirit of the David Powers script I'm trying to work with, that it filters out suspect input, avoids email header injection attacks and blocks submission by spam bots.
    There may be a really simple solution to this since I don't want users to be able to enter an email address at all but I don't know enough to be able to figure it out just yet.
    I'd be grateful for any advice.
    See below for the code for the form including PHP so far...
    Thanks to everyone looking in in advance
    Karl.

    GEAtkins wrote:
    > I am using the redirect to a personal page from page 515
    of The Essential
    > Guide to DWCS3 in the following form:
    $_SESSION[MM_Username].php in the "if
    > login succeeds" field.
    Thank you for reminding me. There's a mistake in the book,
    which I
    discovered over the Christmas period, so forgot to send to
    friends of ED
    for the errata page.
    Don't use $_SESSION[MM_Username]. Use $loginUsername instead.
    It then works.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Flash 8 AS and PHP email form

    Hi,
    I am finally finding some time over the holidays to work on
    my website flash email form. I have had some wonderful help from
    kglad and Chris a couple of months ago. I will attach my AS2 code
    first and then my PHP code I have recieved from Yahoo. (Our hosting
    server for the website).
    I keep getting my error message of... "Sorry, there was a
    server error, please try again."
    I also have specified the default mail account within my
    yahoo small business web account under PHP/Perl Mail Setup
    [email protected] as the Default.
    Any help would be greatly appreciated, and thank you in
    advance!

    Let me prefix this by saying...
    I haven't used an email script directly... I've always used
    an intemediate function when I've been doing things like this
    through a CMS or whatever.. so that's my way of saying I'm not sure
    of this...
    But
    I see two potential things with the mail function based on
    the php docs.
    1. the msg string.
    According to this:
    Each line should be separated with a LF (\n). Lines should
    not be larger than 70 characters.
    You don't seem to have that. I know its html formatted... but
    perhaps you should put the LF chars in.
    2. This is probably far less likely and only try it after the
    first option above (I'm guessing this is very rare):
    For your message headers where you have \r\n
    Note: If messages are not received, try using a LF (\n) only.
    Some poor quality Unix mail transfer agents replace LF by CRLF
    automatically (which leads to doubling CR if CRLF is used). This
    should be a last resort, as it does not comply with » RFC
    2822.

  • PHP email form - issue with who it's from

    Hi,
    I've got a referral page on my site where the user puts in their details and a friends details and the form fires off a email to the friend. The form is in HTML and posts it to a PHP file. The problem is I get in the email for who it's from:
    from
    "Scott Bradshaw"@server74.ukservers.net
    I don't want the
    @server74.ukservers.net
    in their.
    Is this an issue with PHP files and forms or is their a way round it? I know I could do a mailto: form but don't want to. What are my options?
    Thanks, Scott

    I'm making the website for someone and they had the hosting set up already but thanks for telling me. I think this is right what I've done:
    function detectSuspect($val, &$ok) {
      if (preg_match('/Content-Type:|Cc:|Bcc:/i', $val)) {
        $ok = false;
    $YourName = Trim(stripslashes($_POST['YourName']));
    $YourEmail = Trim(stripslashes($_POST['YourEmail']));
    $RefName = Trim(stripslashes($_POST['RefName']));
    $RefEmail = Trim(stripslashes($_POST['RefEmail']));
    $EmailFrom = $YourEmail;
    $Subject = $RefName;
    $EmailTo = $RefEmail;
    // validation
    $validationOK=true;
    detectSuspect($YourName, $validationOK);
    detectSuspect($YourEmail, $validationOK);
    detectSuspect($RefName, $validationOK);
    detectSuspect($RefEmail, $validationOK);
    if (!$validationOK) {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
      exit;
    // prepare email body text
    $Body = "Hi $RefName,
    $YourName thought you would be interested in viewing this online video called A
    tale of 2 customers (< 3 mins).
    www.easybench.org/ataleof2customers3";
    $Body2 = "";
    $Body2 .= "User Name: ";
    $Body2 .= $YourName;
    $Body2 .= "\n";
    $Body2 .= "User Email: ";
    $Body2 .= $YourEmail;
    $Body2 .= "\n";
    $Body2 .= "Referral Name: ";
    $Body2 .= $RefName;
    $Body2 .= "\n";
    $Body2 .= "Referral Email: ";
    $Body2 .= $RefEmail;
    $Body2 .= "\n";
    // send email
    $success = mail($EmailTo, $Subject, $Body, "From: $EmailFrom<$EmailFrom>");
    mail("[email protected]", "Referral details", $Body2, "From: [email protected]");
    // redirect to success page
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou2.html\">";
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
    ?>
    I've also got a feedback form thing too, the script above wouldn't work for it I guess as it's protecting against different thing but what's the best way to protect the feedback form? I've heard of a honeypot thing where create hidden form field.
    Thanks, Scott

  • Simple php email form, on X-serve 10.39 unlimited

    hello! thank you for looking at this.
    i'm being asked to add a contact form to my company's website. i'm not a designer or anything. i'm just feeling my way through things barely.
    i've implemented this code on the site: http://www.freecontactform.com/email_form.php
    things seem to be working ok, except a test email is never recieved in the end. i excpe this is something with the server side handling of the email parts of the code.
    but i have almost no clue about what to check on the server to fix this.
    i realize there are problably other threads that could maybe help me, but i know very little and thought it might be faster to post a new thread, because the boss wants this done tomorrow.
    i am using server admin 10.3 v106, 2003
    thanks for any help!

    it looks like i'm running php 4.4.7
    one of my concerns is that this version might be too old to handle the script.

  • Help with ActionScript/PHP email form

    Hey guys, hope someone can help me out with this!
    Haven't programmed in a while, but a friend asked me to look
    at this and figure out why it isn't working. It's a simple form,
    with the text boxes labeled inTxt_1, inTxt_2 ..... inTxt_13.
    The ActionScript looks like this ...
    Code:
    submit.onRelease = function () {
    var loadv = new LoadVars();
    loadv._level0.mc1.inTxt_1 = _level0.mc1.inTxt_1.text;
    loadv._level0.mc1.inTxt_2 = _level0.mc1.inTxt_2.text;
    loadv._level0.mc1.inTxt_3 = _level0.mc1.inTxt_3.text;
    loadv._level0.mc1.inTxt_4 = _level0.mc1.inTxt_4.text;
    loadv._level0.mc1.inTxt_5 = _level0.mc1.inTxt_5.text;
    loadv._level0.mc1.inTxt_6 = _level0.mc1.inTxt_6.text;
    loadv._level0.mc1.inTxt_7 = _level0.mc1.inTxt_7.text;
    loadv._level0.mc1.inTxt_8 = _level0.mc1.inTxt_8.text;
    loadv._level0.mc1.inTxt_9 = _level0.mc1.inTxt_9.text;
    loadv._level0.mc1.inTxt_10 = _level0.mc1.inTxt_10.text;
    loadv._level0.mc1.inTxt_11 = _level0.mc1.inTxt_11.text;
    loadv.send("email.php",loadv,"POST");
    (Quick question ... why is the _level0.mc1 part needed? Or is
    it even required?)
    Here's the PHP ...
    Code:
    <?php
    $To = "[email protected]";
    $subject = "site reply";
    $Name = $_POST["inTxt_1"];
    $Email = $_POST["inTxt_2"];
    $Company = $_POST["inTxt_3"];
    $Position = $_POST["inTxt_4"];
    $Address = $_POST["inTxt_5"];
    $Address1 = $_POST["inTxt_6"];
    $Address2 = $_POST["inTxt_7"];
    $ZipCode = $_POST["inTxt_8"];
    $Country = $_POST["inTxt_9"];
    $Tel = $_POST["inTxt_10"];
    $Enquiry = $_POST["enquiry"];
    $Comments = $_POST["inTxt_11"];
    \$headers = "From: " . $_POST["inTxt_1"]. "<" .
    $_POST["inTxt_2"] .">\r\n";
    $headers .= "Reply-To: " . $_POST["inTxt_2"] . "\r\n";
    $headers .= "Return-path: " . $_POST["inTxt_2"];
    $message = "Name: $Name\n";
    $message .= "Position: $Position\n";
    $message .= "Company: $Company\n";
    $message .= "Email: $Email\n";
    $message .= "Address: $Address\n";
    $message .= "Address1: $Address1\n";
    $message .= "Address2: $Address2\n";
    $message .= "Zip Code: $ZipCode\n";
    $message .= "Country: $Country\n";
    $message .= "Enquiry: $Enquiry\n";
    $message .= "Phone: $Tel\n";
    $message .= "Comments: $Comments\n";
    mail($To, $subject, $message, $headers);
    Print "Your mail has been sent";
    ?>
    (Another question - why does the one $headers line have a /
    infront of it? Should it be there?)
    Now when I submit it, "Your mail has been sent" appears on
    the screen, but I don't receive an e-mail. Can anyone help me??
    Thanks so much!!
    ~Ganj

    all those loadv._level0.mc1.whatever variables are incorrect.
    they should be:

  • PHP Email form, need help...

    Heya,
    I have a flash form that uses PHP to send the data to an
    email, but it causes all of the data to display on the same line
    with no spaces when recieved via email, can anyone help? Thanks!
    Code:
    <?php
    $sendTo = "[email protected]";
    $subject = "Contact Form from Cabinet Source Website";
    $headers = "From: " . $_POST["name"] ." ". $_POST["phone"] .
    "<" . $_POST["comments"] .">\r\n";
    $headers .= "Reply-To: " . $_POST["name"] . "\r\n";
    $headers .= "Return-path: " . $_POST["name"];
    $message = $_POST["comments"];
    mail($sendTo, $subject, $message, $headers);
    ?>

    As bregent says, the names of the variables you're assigning at the top of the script don't match the variables that you're adding to the $body.
    Another problem is that you're using lowercase for the $_POST array. For example, you have $_post['gt']. PHP is case-sensitive. It should be $_POST['gt'].
    Even when you get those problems sorted out, the script is extremely insecure because you're not checking any of the values submitted. In particular, you're assigning the value of the 'gt' input field to the From: header. This will lay the form wide open to attack by spammers. (Google for "email header injection" to understand the problem.)
    If you want to put a value from the form into the headers, you must first make sure it's safe. For example, I see that gt is meant to be an Xbox Live gamertag. Assuming it must contain only letters and numbers, you should sanitize it like this before inserting it into the headers:
    $gt = filter_input(INPUT_POST, 'gt', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^[a-zA-Z0-9]+$/')));

  • Php email form with styling

    Hi
    I have a php file which generates an email from a form in a
    website I have designed. I just want to make some areas of the
    final generated email in bold text. I know if people have plain
    text only selected in their email client they won't see the bold
    text, but at least it will reach a certain percentage of users.
    the line in question is -
    $body ="Booking request details from website:\n\n";
    I have tried putting <b></b> and
    <strong></strong>, inside the inverted commas, outside
    etc, plus tried different declarations within the <head>,
    nothing works! What am I doing wrong?
    I am a beginner with this php stuff, please be kind!
    Thanks

    .oO(BarryGBrown)
    > I have a php file which generates an email from a form
    in a website I have
    >designed. I just want to make some areas of the final
    generated email in bold
    >text. I know if people have plain text only selected in
    their email client they
    >won't see the bold text, but at least it will reach a
    certain percentage of
    >users.
    You can't do bold text in a normal email. Plain text is just
    that -
    plain text. For anything more you need HTML. _If_ you should
    need it.
    Usually plain text serves pretty well and is the most
    efficient way.
    > the line in question is -
    >
    > $body ="Booking request details from website:\n\n";
    >
    > I have tried putting  and ,
    syntax is used in some forum software, but besides that it
    has
    no meaning whatsoever.
    >inside the inverted commas, outside
    >etc, plus tried different declarations within the
    <head>, nothing works! What
    >am I doing wrong?
    You would have to create an entire HTML email with all the
    required
    headers and boundaries. Quite difficult to do by hand with
    PHP's mail()
    function.
    > I am a beginner with this php stuff, please be kind!
    Then you should start simple with plain text. There are some
    classes out
    there which make it easy to generate text and HTML emails
    (phpmailer for
    example), but you should be familiar with PHP coding if you
    want to use
    them.
    Micha

  • PHP email form with Validation - not working

    Hello;
    I am new to using php. I usually use coldfusion or asp but this site requires me to write in php. I have a form I am trying to get to work and right now.. it doesn't do anyhting but remember what you put in the fields. It doesn't want to send, and it won't execute the validation script for the fields that are required. Can anyone help me make this work? I'm confused and a definate newbie to PHP.
    Here is my code:
    <?php    
                  $PHP_SELF = $_SERVER['PHP_SELF'];   
                  $errName    = "";   
                  $errEmail    = "";
                  $errPhone    = "";        
                  if(isset($_POST['submit'])) {        
                          if($_POST["ac"]=="login"){            
                        $FORMOK = TRUE;    // $FORMOK acts as a flag. If you enter any of the conditionals below,                             // it gets set to FALSE, and the e-mail will not be sent.
                        // First Name           
                        if(preg_match("/^[a-zA-Z -]+$/", $_POST["name"]) === 0) {               
                            $errName = '<div class="errtext">Please enter you name.</div>';               
                            $FORMOK = FALSE;           
                        // Email           
                    if(preg_match("/^[a-zA-Z]\w+(\.\w+)*\@\w+(\.[0-9a-zA-Z]+)*\.[a-zA-Z]{2,4}$/", $_POST["email"]) === 0) {                                                    $errEmail = '<div class="errtext">Please enter a valid email.</div>';               
                            $FORMOK = FALSE;           
                        // Phone           
                        if(preg_match("/^[a-zA-Z -]+$/", $_POST["phone"]) === 0) {               
                            $errPhone = '<div class="errtext">Please enter your phone number.</div>';               
                            $FORMOK = FALSE;           
                        if($FORMOK) {               
                                $to = "[email protected]";  
                                $subject = "my. - Contact Form";                  
                                $name_field = $_POST['name'];               
                                $email_field = $_POST['email'];               
                                $phone_field = $_POST['phone'];
                                $city_field = $_POST['city'];
                                $state_field = $_POST['state'];               
                                $message = $_POST['comment'];                
                                $message = "               
                                Name: $name_field               
                                Email: $email_field
                                Phone: $phone_field   
                                City: $city_field   
                                State: $state_field               
                                Message: $message";                
                                $headers  = 'MIME-Version: 1.0' . "\r\n";               
                                $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";                
                                // Additional headers               
                                $headers .= 'To: <[email protected]>' . "\r\n";               
                                $headers .= '[From] <$email_field>' . "\r\n";                
                                // Mail it               
                                mail($to, $subject, $message, $headers);                
                                header("Location: thankyou.php")
                                // I have no idea what these next 3 lines are for. You may just want to get rid of them.                   
    ini_set("sendmail_from","[Send from]");
    ini_set("SMTP","[mail server]");
    mail($to, $subject, $message, $headers);
                                } else {               
                                echo "Error!";              
                        ?>
    <form method="post" action="<?php $PHP_SELF ?>" id="commentForm">
    <input name="name" size="40" value="<?php echo $_POST["name"]; ?>" type="text">
                         <?php  if(isset($errName)) echo $errName; ?>
    <input name="email" size="40" value="<?php echo $_POST["email"]; ?>"  type="text">
            <?php  if(isset($errEmail)) echo $errEmail; ?>
    <input name="phone" size="40" value="<?php echo $_POST["phone"]; ?>" type="text" id="phone">
            <?php  if(isset($errPhone)) echo $errPhone; ?>
    <input name="city" size="40" value="<?php echo $_POST["city"]; ?>" type="text" id="city">
    <input name="state" size="40" value="<?php echo $_POST["state"]; ?>" type="text" id="state">
    <textarea name="comment" cols="30" rows="10" id="comment"><?php echo $_POST["comment"]; ?></textarea>
    <input type="submit" value="Submit" name="submit" class="contact-submit" />
    </form>
    It seems pretty simple.. but it's not working at all. I would also like this page to submit to it's self, and when it actually does send an email, to just make the form disappear and replace it with the thank you text instead of sending you to another page. I also do not need to use an smtp server, it goes directly to the network server when sent.
    I'm really sorry to ask all of this, I'm trying to learn this language and need to make this work.
    Thank you for anyones help in advance.

    .oO(BarryGBrown)
    > I have a php file which generates an email from a form
    in a website I have
    >designed. I just want to make some areas of the final
    generated email in bold
    >text. I know if people have plain text only selected in
    their email client they
    >won't see the bold text, but at least it will reach a
    certain percentage of
    >users.
    You can't do bold text in a normal email. Plain text is just
    that -
    plain text. For anything more you need HTML. _If_ you should
    need it.
    Usually plain text serves pretty well and is the most
    efficient way.
    > the line in question is -
    >
    > $body ="Booking request details from website:\n\n";
    >
    > I have tried putting  and ,
    syntax is used in some forum software, but besides that it
    has
    no meaning whatsoever.
    >inside the inverted commas, outside
    >etc, plus tried different declarations within the
    <head>, nothing works! What
    >am I doing wrong?
    You would have to create an entire HTML email with all the
    required
    headers and boundaries. Quite difficult to do by hand with
    PHP's mail()
    function.
    > I am a beginner with this php stuff, please be kind!
    Then you should start simple with plain text. There are some
    classes out
    there which make it easy to generate text and HTML emails
    (phpmailer for
    example), but you should be familiar with PHP coding if you
    want to use
    them.
    Micha

  • Radio Buttons for Flash PHP email.

    Hi.
    I need to add a sign-up form for services to a flash AS2 web site.
    I found a very simple example of a Flash/ PHP email form at Kirupa.
    It works fine, but I need to add some radio buttons.
    My web site will offer various services.
    Ideally I would like to be able for viewers to sign up for a service by clicking the appropriate right radio buttons
    F.ex;
    •   Service 1
    •   Service 2
    •   Service 3
    •   Service 4
    The email should reflect the choices made by listing the text on the selected services (radio buttons).
    Please download the FLA and the PHP file (at the bottom of the tutorial) here:
    http://www.kirupa.com/developer/actionscript/flash_php_email.htm
    I have uploaded a working version here:
    http://gggraphic.com/flash_mail/simple_flash_mail.php
    How do I add and script the radio buttons with both AS and the PHP to make it happen?
    Thank you on beforehand for your help
    ggaarde

    Hi Again
    Maybe check buttons would be a more natural option for this. You should be able to select more than one service.
    Thanks
    ggaarde

  • Trouble linking AS3 and PHP to create email form

    I am using one of the Adobe cookbooks to create an email form for my flash website. I am SO close to getting this right and need some help! I used the AS3 code below as well as the PHP code below in order to create the email form. Everything seems to be working fine, that is until I try to send an email using the form. When I input all of the text into the form, I get the actionscript default warning I wrote that states "Oh no! Something is wrong! Try again..." Hence the email will not send. What could be wrong with the script? Or does it matter where I file the PHP file, my swf file, html file, and my fla file? I tried several combinations of filing everything together, seperate, and everything in between. Help! And thanks for anyone who can help!
    ACTIONSCRIPT CODE USED:
    stop();
    Buttons      
    sendbtn.buttonMode = true;
    sendbtn.addEventListener(MouseEvent.CLICK, submit);
    resetbtn.buttonMode = true;
    resetbtn.addEventListener(MouseEvent.CLICK, reset);
    Variables needed       
    var timer:Timer; var varLoad:URLLoader = new URLLoader;
    var urlRequest:URLRequest = new URLRequest( "mail.php" );
    urlRequest.method = URLRequestMethod.POST;
    Functions
    function init():void{
    //Set all fields to empty
    yourName.text = "";
    fromEmail.text = "";
    yourSubject.text = "";
    YourMsg.text = "";
    function submit(e:MouseEvent):void{
    //Check to see if any of the fields are empty
    if( yourName.text == "" || fromEmail.text == "" ||
    yourSubject.text == "" ||YourMsg.text == "" )
    { valid.text = "All fields need to be filled.";
    //Check if you're using a valid email address
    else if( !checkEmail(fromEmail.text) )
    { valid.text = "Enter a valid email address"; }
    else { valid.text = "Sending over the internet...";
    var emailData:String = "name="
    + yourName.text + "&from="
    + fromEmail.text + "&subject="
    + yourSubject.text + "&msg=" + YourMsg.text;
    var urlVars:URLVariables = new URLVariables(emailData);
    urlVars.dataFormat = URLLoaderDataFormat.TEXT;
    urlRequest.data = urlVars; varLoad.load( urlRequest );
    varLoad.addEventListener(Event.COMPLETE, thankYou );
    function reset(e:MouseEvent):void{
    init(); //call the initial clear function
    function checkEmail(s:String):Boolean {
    //This tests for correct email address
    var p:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/; var
    r:Object = p.exec(s);
    if( r == null ) {
    return false;
    return true;
    function thankYou(e:Event):void {
    var loader:URLLoader =
    URLLoader(e.target);
    var sent = new
    URLVariables(loader.data).sentStatus; if( sent == "yes" )
    valid.text = "Thanks for your email!";
    timer = new Timer(500);
    timer.addEventListener(TimerEvent.TIMER, msgSent);
    timer.start();
    else {
    valid.text = "Oh no! Something is wrong! Try again..."; }
    function msgSent(te:TimerEvent):void {
    if( timer.currentCount >= 10 ) { init();
    timer.removeEventListener(TimerEvent.TIMER, msgSent);
    PHP CODE USED
    <?php $yourName = $_POST['name'];
    $fromEmail = $_POST['from']; 
    $yourSubject = $yourSubject = $_POST['subject'];
    $YourMsg = $_POST['msg'];
    if( $yourName == true ) { $sender = $fromEmail; $yourEmail ="[email protected]";  (I have changed this to my email address, although not given in example)
    $ipAddress = $_SERVER['REMOTE_ADDR']; 
    $emailMsg = "$ipAddress \n$yourName  \n$sender
    \n\n$YourMsg 
    \n\n\n--Memo for myself--";$return = "From: $sender\r\n" .
    "Reply-To:$sender \r\n" ."X-Mailer: PHP/" . phpversion();
    if( mail( $yourEmail, "$yourSubject", $emailMsg, $return
    echo "sentStatus=yes"; }
    else { echo "sentStatus=no"; } }
    { $sender = $fromEmail; $yourEmail ="$fromEmail"; 
    $emailMsg = "\n\n\n--Memo for the sender. i.e. this is a copy of message you sent me.--
    \n\n$yourName  \n$sender
    \n$YourMsg \n";$return = "From: $sender\r\n" .
    "Reply-To:$sender \r\n" ."X-Mailer: PHP/" . phpversion();
    if( mail( $yourEmail, "$yourSubject", $emailMsg, $return
    echo "sentStatus=yes"; }
    else { echo "sentStatus=no"; } }
    ?>

    It may be indeed a problem of your server rsp. how it handles security issues and relative path-linking.
    You wrote: "Or does it matter where I file the PHP file, my swf file, html file, and my fla file..." I suppose you mean where to put all the files.
    1.Its a good beginners choice to put all the files you need (swf, html, php you don`t need the fla file on ) in the same directory of your server.
    2.If you publish to html from flash there will be three tags in the html (use a texteditor to look at the html-code) that read like this:
    <param name="allowScriptAccess" value="sameDomain" />
    change them for testing purposes to
    <param name="allowScriptAccess" value="always" />
    3.On some servers to prevent malicious code php scripts are restricted to certain directorys, look up the phpinfo on your server
    4.Even if swf, html and php are in one and the same directory use a "hard" path in your fla file for testing purposes, for example instead of calling "file.php" in your actionscript, call ("http://www.mydomain.com/directory/file.php"), when testing from flash you may get a better response where the problem lies

  • Email form with php

    Hello,
    I have been reading that mailto: is outdated.  I have been reading on creating an email form using php.  I don't  understand.  Do you create a table first to put the info:
    First Name:
    Last Name:
    Email:
    Message:
    Submit button
    Does anyone know of a comprehensive article that I could read with maybe some examples or even tutorial.   This is my webstie www.ewrolexrepair.com.  This is my first website.  I am trying to put somekind of email contact next to my picture.  Any help would be greatly appreciated.  Thanks!

    Below is a ready made php form including First Name, Last Name, Email and Message.
    The form is sent back to the page it is located on i.e. if the form is inserted into a page called 'contact.php' then the action form field would be as follows: <form id="enquiryForm" name="enquiryForm" method="post" action="contact.php">
    Change the below in the code to your email address (the one you want the info to be sent to):
    $to = "[email protected]"; //email address -- change to your own email address
    Change success.php below in the code to the page you want the user to go to after submitting the form.
    header("Location: success.php");
    //Redirect page -- change to your own page
    <!-- FORM CODE STARTS HERE -->
    <?php session_start(); ?>
    <?php
    if (array_key_exists('submit', $_POST)) {
        // check first_name field
    $first_name = trim($_POST['first_name']);
    if (empty($first_name)) {
        $error['first_name'] = 'Please provide your first name';
    elseif ($first_name == 'Please provide your first name') {
        $error['first_name'] = '';
    $_SESSION['first_name'] = $_POST['first_name'];
    // check last_name field
    $last_name = trim($_POST['last_name']);
    if (empty($last_name)) {
        $error['last_name'] = 'Please provide your last name';
    elseif ($last_name == 'Please provide your last name') {
        $error['last_name'] = '';
    $_SESSION['last_name'] = $_POST['last_name'];
    // check email field
    $email = trim($_POST['email']);
    if (empty($email)) {
        $error['email'] = 'Please enter your email address';
    elseif ($email == 'Please enter your email address') {
        $error['email'] = '';
    $_SESSION['email'] = $_POST['email'];
    // check enquiry field
    $message = trim($_POST['message']);
    if (empty($message)) {
        $error['message'] = 'Please enter your message details';
    elseif ($message == 'Please enter your message details') {
        $error['message'] = '';
    $_SESSION['message'] = $_POST['message'];
    if (!empty($_POST['ufo'])) { return false; }
    // recipient
    $to = "[email protected]"; //email address -- change to your own email address
    // email subject
    $subject = "Enquiry from Website";
    // sender
    $sender = "From: ".$_POST['email']."\r\n";
    // build message
    $enquiry = "First Name: $first_name\n\n";
    $enquiry .= "Last Name: $last_name\n\n";
    $enquiry .= "Email Address: $email\n\n";
    $enquiry .= "Message: $message\n\n";
    // send email if no form erorrs
    if (!isset($error)) {
    mail($to, $subject, $enquiry, $sender);
    header("Location: success.php");        //Redirect page -- change to your own page
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>PHP Form Test</title>
    <style type="text/css">
    /* style the form input fields */
    #enquiryForm input {
        font-family: arial, verdana, sans-serif;
        font-size: 12px;
        width: 300px;
        padding: 5px;
    /* style the form textarea field */
    #enquiryForm textarea {
        font-family: arial, verdana, sans-serif;
        font-size: 12px;
        width: 300px;
        padding: 5px;
    /* style the form submit button */
    #enquiryForm #submitButton {
        width: 100px;
    </style>
    </head>
    <body>
    <form id="enquiryForm" name="enquiryForm" method="post" action="contact.php">
    <h2>Online Enquiry</h2>
    <p>Required Information*</p>
    <p><label for="Name">First Name* </label><br />
    <input type="text" name="first_name" id="first_name" <?php if(isset($error['first_name'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($first_name)) {echo $first_name;} ?><?php if(isset($error['first_name'])) echo $error['first_name']; ?>" onfocus="this.value=''"></p>
      <p><label for="Name">Last Name* </label><br />
      <input type="text" name="last_name" id="last_name" <?php if(isset($error['last_name'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($last_name)) {echo $last_name;} ?><?php if(isset($error['last_name'])) echo $error['last_name']; ?>" onfocus="this.value=''"></p>
      <p><label for="email">Email<span>*</span>
    </label><br />
      <input type="text" name="email" id="email" <?php if(isset($error['email'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($email)) {echo $email;} ?><?php if(isset($error['email'])) echo $error['email']; ?>" onfocus="this.value=''"></p>
      <p style="padding-bottom: 0;"><label for="enquiry">Message<span>*</span></label><br />
      <textarea name="message" id="message" <?php if(isset($error['message'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> onfocus="this.value=''"><?php if(isset($message)) {echo $message;} ?><?php if(isset($error['message'])) echo $error['message']; ?></textarea></p>
    <p><input type="text" name="ufo" style="display: none;"></p>
    <p><input type="submit" id="submitButton" name="submit" value="Send Enquiry" /></p>
      </form>
    </body>
    </html>

  • How do i change the path of data ajax false from returning to homepage, when using a PHP mail form in jquery mobile?

    I have a put a php mail form in the quote page of my mobile site. However when i send the form it returns to the route page rather than the quote page, i have used the data ajax false action as i dont want to send via ajax. i have left the thanks page blank as i want it to remain on the same page showing sent or declined message.  Can someone help please? 
    <?php
    // OPTIONS - PLEASE CONFIGURE THESE BEFORE USE!
    $yourEmail = "[email protected]"; // the email address you wish to receive these mails through
    $yourWebsite = "www.firstcalltransport.co.uk"; // the name of your website
    $thanksPage = ''; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page
    $maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4
    $requiredFields = "name,email,collection,delivery,comments"; // names of the fields you'd like to be required as a minimum, separate each field with a comma
    // DO NOT EDIT BELOW HERE
    $error_msg = array();
    $result = null;
    $requiredFields = explode(",", $requiredFields);
    function clean($data) {
      $data = trim(stripslashes(strip_tags($data)));
      return $data;
    function isBot() {
      $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz");
      foreach ($bots as $bot)
      if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false)
      return true;
      if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ")
      return true;
      return false;
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
      if (isBot() !== false)
      $error_msg[] = "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT'];
      // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score..
      // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam
      $points = (int)0;
      foreach ($badwords as $word)
      if (
      strpos(strtolower($_POST['comments']), $word) !== false ||
      strpos(strtolower($_POST['name']), $word) !== false
      $points += 2;
      if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false)
      $points += 2;
      if (isset($_POST['nojs']))
      $points += 1;
      if (preg_match("/(<.*>)/i", $_POST['comments']))
      $points += 2;
      if (strlen($_POST['name']) < 3)
      $points += 1;
      if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
      $points += 2;
      if (preg_match("/[bcdfghjklmnpqrstvwxyz]{7,}/i", $_POST['comments']))
      $points += 1;
      // end score assignments
      foreach($requiredFields as $field) {
      trim($_POST[$field]);
      if (!isset($_POST[$field]) || empty($_POST[$field]) && array_pop($error_msg) != "Please fill in all the required fields and submit again.\r\n")
      $error_msg[] = "Please fill in all the required fields and submit again.";
      if (!empty($_POST['name']) && !preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name'])))
      $error_msg[] = "The name field must not contain special characters.\r\n";
      if (!empty($_POST['email']) && !preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+ ' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email'])))
      $error_msg[] = "That is not a valid e-mail address.\r\n";
      if (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\ /?/i', $_POST['url']))
      $error_msg[] = "Invalid website url.\r\n";
      if ($error_msg == NULL && $points <= $maxPoints) {
      $subject = "Automatic Form Email";
      $message = "You received this e-mail message through your website: \n\n";
      foreach ($_POST as $key => $val) {
      if (is_array($val)) {
      foreach ($val as $subval) {
      $message .= ucwords($key) . ": " . clean($subval) . "\r\n";
      } else {
      $message .= ucwords($key) . ": " . clean($val) . "\r\n";
      $message .= "\r\n";
      $message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
      $message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n";
      $message .= 'Points: '.$points;
      if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
      $headers   = "From: $yourEmail\r\n";
      } else {
      $headers   = "From: $yourWebsite <$yourEmail>\r\n";
      $headers  .= "Reply-To: {$_POST['email']}\r\n";
      if (mail($yourEmail,$subject,$message,$headers)) {
      if (!empty($thanksPage)) {
      header("Location: $thanksPage");
      exit;
      } else {
      $result = 'Your mail was successfully sent.';
      $disable = true;
      } else {
      $error_msg[] = 'Your mail could not be sent this time. ['.$points.']';
      } else {
      if (empty($error_msg))
      $error_msg[] = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']';
    function get_data($var) {
      if (isset($_POST[$var]))
      echo htmlspecialchars($_POST[$var]);
    ?>
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <link href="CSS/stylesheetnew.css" rel="stylesheet" type="text/css">
    <link href="../jquery-mobile/jquery.mobile-1.0a3.min.css" rel="stylesheet" type="text/css">
    <script src="../jquery-mobile/jquery-1.5.min.js" type="text/javascript"></script>
    <script src="../jquery-mobile/jquery.mobile-1.0a3.min.js" type="text/javascript"></script>
    <style type="text/css">
      p.error, p.success {
      font-weight: bold;
      padding: 10px;
      border: 1px solid;
      p.error {
      background: #ffc0c0;
      color: #F00;
      p.success {
      background: #b3ff69;
      color: #4fa000;
    </style>
    </head>
    <body>
    <div data-role="page" id="home">
      <div data-role="header" data-position="fixed">
       <h1>FIRSTCALL TRANSPORT</h1>
    </div>
        <div data-role="navbar" data-position="fixed">
                                    <ul>
                                      <li><a href="#about">About</a></li>
                                      <li><a href="#services">Services</a></li>
                                      <li><a href="#contact">Contact</a></li>
                                      <li><a href="#quote">Quote</a></li>
                                    </ul>
      </div>
      <div data-role="content"> </div>
         <div data-role="footer" data-position="fixed" > </div>
    </div>
    </div>
    <div data-role="page" id="quote">
      <div data-role="header" data-position="fixed">
        <h1>GET A QUOTE</h1>
      </div>
      <div data-role="content">
       <?php
    if (!empty($error_msg)) {
      echo '<p class="error">ERROR: '. implode("<br />", $error_msg) . "</p>";
    if ($result != NULL) {
      echo '<p class="success">'. $result . "</p>";
    ?>
    <form action="<?php echo basename(__FILE__); ?>" method="post" data-ajax="false"  >
    <noscript>
      <p><input type="hidden" name="nojs" id="nojs" /></p>
    </noscript>
    <p>
      <label for="name">Name: *</label>
      <input type="text" name="name" id="name" value="<?php get_data("name"); ?>" /><br />
      <label for="email">E-mail: *</label>
      <input type="text" name="email" id="email" value="<?php get_data("email"); ?>" /><br />
            <label for="company">Company:</label>
      <input type="text" name="company" id="company" value="<?php get_data("company"); ?>" /><br />
      <label for="collection">Collection: *</label>
      <input type="text" name="collection" id="collection" value="<?php get_data("collection"); ?>" /><br />
        <label for="delivery">Delivery: *</label>
      <input type="text" name="delivery" id="delivery" value="<?php get_data("delivery"); ?>" /><br />
      <label for="comments">Message: *</label>
      <textarea name="comments" id="comments" rows="5" cols="20"><?php get_data("comments"); ?></textarea><br />
      <input type="submit" name="submit" id="submit" value="Send" <?php if (isset($disable) && $disable === true) echo ' disabled="disabled"'; ?> />
    </p>
    </form>  </div>
         <div data-role="footer" >  </div>
      </div>
      </div>           
    </body>
    </html>

    My wife has left me for four weeks, favouring to be with our son who lives 4,000 km away. I now have to cook for myself and the steaks taste horrible. What am I doing wrong?
    If you do not know what I have (not) done to make the steak taste horrible, my question is as hard to answer as your question above.
    Please give us more info like giving us the code that sends the page to the homepage rather than to the previous page.

Maybe you are looking for

  • Goods Return ---Debit Note

    Dear Experts Whenever we r making Goods return Invoice after creating Debit Note material Document system will allow us to make Multiple Invoice through one material Document (debit note) in J1is. it would be happen , how to control  over the message

  • Rollback in Master-Detail form - SOLVED

    Hellou. I have 2 blocks Mater-Detail relation. I execute query and make some changes in Items from block 1 and some changes in items in block 2.There are althoug some POSTs. I have Button "Change Back" and i need to use this button to rollback all ch

  • How to react to Microsoft Word events?

    My program runs Microsoft Word (setting "ws" = Word). I can issue commands to Word, but can I also react to Word events? I set ws to be "withevents" but that didn't seem to make wd's events available to my program. Robert Homes

  • Repeatedly installing flash player

    I know this problem probably pops up all the time on here, but I have not been able to find a solution. I'll start with the fact that I have never had any problems with my macbook since the day I bought it a year and a half ago. Everything has been i

  • I need to talk to someone regarding mobile me now

    help