Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 7 of 7

Thread: adding new field to form and PHP

  1. #1

    adding new field to form and PHP


    I am using this script for my first simple mailform:

    $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!

    registro ergo sum

  2. #2

    Just add that var to the $message


    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:

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

    $subject "Whatever";

    $message =   "<html>
                         <td>Email Address:&nbsp;-&nbsp;</td><td>

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



  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.


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

    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....

  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

  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


Copyright 1999 - 2012