Results 1 to 7 of 7

Thread: adding new field to form and PHP

  1. #1

    adding new field to form and PHP

    Hi,

    I am using this script for my first simple mailform:

    <?php
    $sendTo = "blabla@winder.demon.nl";
    $subject = "Videoproducties";

    $headers = "From: " . $_POST["name"] ." <" . $_POST["email"] .">\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $headers .= "Return-path: " . $_POST["email"];
    $message = $_POST["message"];
    mail($sendTo, $subject, $message, $headers);
    ?>
    I have added an extra input text field to my flash form, and gave it the var name 'question' . How should i add this in the PHP script??

    Another question is:
    Can I add a checkbox to a form like this?
    How should I add that to the PHP script (I can't give a var name to the checkbox in Flash, can I?)

    Thank you very much!

    Jerryj.
    registro ergo sum

  2. #2

    Just add that var to the $message

    Hey,

    I have a similar script on one of my sites. I will paste it for you to look at, albeit my $message is set up as HTML

    PHP Code:

    $to  
    "blah@blah.co.uk" ", " ;

    $subject "Whatever";

    $message =   "<html>
                    <body>
                        <table>
                        <tr>
                         <td><b>Details</b></td>
                        </tr>
                        <tr><td>Name:&nbsp;-&nbsp;</td><td>
    $name</td>
                        </tr>
                        <tr>
                         <td>Email Address:&nbsp;-&nbsp;</td><td>
    $email</td>
                        </tr>
                        <tr>
                         <td>Question/Comment:&nbsp;-&nbsp;</td><td>
    $question</td>
                        </tr>
                        </table>
                    </body>
                </html>"
    ;

    $headers  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: $name <$email>\r\n";

    mail($to$subject$message$headers);

    Kaykills

  3. #3
    Another question is:
    Can I add a checkbox to a form like this?
    I think you can do the same as you would any other var. Just refernce that var in the $message of the php script and the value of the checkbox should show. Not 100% about that one though.

    Cheers
    Michael
    Kaykills

  4. #4
    thanks for your answer,
    but I just dont know how to add extra vars to the message in PHP language!

    thanks,
    Jerryj.
    registro ergo sum

  5. #5
    PHP Code:
    $message $_POST["message"]; 
    This is your last line in the php script. Do you actually have a var named message in flash?? if so then you can do the following:

    PHP Code:
    $message $_POST["message"];
    $message .= $_POST["question"]; 
    if you don't then:

    PHP Code:
    $message $_POST["question"]; 
    should work....
    Kaykills

  6. #6

    jerryj - even simpler

    try this as TVIRUS pointed out in another thread.


    PHP Code:
    $addressbar $_POST['addressbar']; 
    $website $_POST['website']; 
    $phone $_POST['phone']; 
    $comments $_POST['comments']; 

    // For spaces between the values use this 
    $message    $addressbar." ".$website." ".$phone." ".$comments

    // For new lines use this 
    $message    $addressbar."\n".$website."\n".$phone."\n".$comments

    // For HTML email use this 
    $message    $addressbar."<br>".$website."<br>".$phone."<br>".$comments
    Kaykills

  7. #7
    very helpfull.

    thank you!
    registro ergo sum

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012