Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Thanked 3 Times in 3 Posts

    How can I send an array to e-mail from a form?

    The form below works except the checkboxes named "features" returns in the e-mail as the word "Array" instead of the actual array of variables checked. What PHP code am I missing that corrects this? All styling has been removed for easier viewing.

    $message="Title: $title \nURL: <a href='$url'>$url</a> \nE-mail: $email \nDescription: $description 
    \nFeatures: $features \nGenre: $genre \nUpdate: $update \nAge: $age \n
    Movies: $movies \nReference: $reference \nOther: $other";
    if (strpos($email,"@")==0 or strpos($email,".")==0){$email="";}
    if ($email!="" and $description!="" and $title!="" and $url!=""){
       mail("my@email.com","Subject", $message,"From: <my@email.com>\nContent-Type: text/plain");
       print "<p id='submissionConfirmation'>Submission Sent!</p>";
    <form method=post action=<? print $_SERVER["PHP_SELF"]; ?>>
    Site Title:<input name="title">
    URL:<input name="url">
    E-mail:<input name="email">
    <input type="checkbox" name="features[]" value="News" /> News<br />
    <input type="checkbox" name="features[]" value="Reviews" /> Reviews<br />
    <input type="checkbox" name="features[]" value="Interviews" /> Interviews<br />
    <input type="checkbox" name="features[]" value="Editorials" /> Editorials<br />
    <input type="checkbox" name="features[]" value="Humor" /> Humor<br />
    <input type="checkbox" name="features[]" value="Gossip" /> Gossip<br />
    <input type="checkbox" name="features[]" value="Podcasts" /> Podcasts<br />
    <input type="checkbox" name="features[]" value="Video" /> Videos (Original)<br />
    <input type="checkbox" name="features[]" value="Non-Movie" /> Non-Movie Topics
    <select name="genre">
    <option value="All / Other">All / Other</option>
    <option value="Animation / Anime">Animation / Anime</option>
    <option value="Classic">Classic</option>
    <option value="Comedy">Comedy</option>
    <option value="Horror">Horror</option>
    <option value="Independent / Foreign">Independent / Foreign</option>
    <option value="Nerdy (Sci-fi, Fantasy, etc.)">Nerdy (Sci-fi, Fantasy, etc.)</option>
    <option value="Film Noir">Film Noir</option>
    <option value="TV">TV</option>
    How often do you update?:
    <select name="update">
    <option value="No Answer">Select One&hellip;</option>
    <option value="Daily">Daily</option>
    <option value="Every Other Day">Every Other Day</option>
    <option value="Weekly">Weekly</option>
    <option value="Bi-Weekly">Bi-Weekly</option>
    <option value="Monthly">Monthly</option>
    How old is your site?:
    <select name="age">
    <option value="No Answer">Select One&hellip;</option>
    <option value="1 - 3 Months">1 - 3 Months</option>
    <option value="3 - 6 Months">3 - 6 Months</option>
    <option value="6 - 12 Months">6 - 12 Months</option>
    <option value="1 - 2 Years">1 - 2 Years</option>
    <option value="2+ Years">2+ Years</option>
    List 3 of your favorite movies:
    <textarea name="movies"><? print $text; ?></textarea>
    Where did you first hear about CineBloggers?:
    <textarea name="reference"><? print $text; ?></textarea>
    Any other questions you would like to answer that have not been covered?:
    <textarea name="other"><? print $text; ?></textarea>
    <input type="submit" height="33" width="100" name="submit" value="Submit">
    <? } ?>
    Last edited by cineweekly.com; 11-15-2011 at 07:04 AM.

  • #2
    Regular Coder
    Join Date
    Sep 2011
    Thanked 37 Times in 37 Posts
    This is not the correct forum for that. Much better would be the PHP forum.

    How to: Target IE in, Position in, Center in, Create a Fixed ('Sticky') Footer with, and Create a Drop-Down/Fly-Out Menu with CSS: Website Laten Maken Amsterdam.

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Thanked 0 Times in 0 Posts
    why applying everything in a single php file ? create two separate files one html and one php html file will have the structure and JS to validate the fields and the php file will send you the email of whatever information has been filled on the first form using POST method. If you want I can create one for you

    P S : I have executed your script write now it is very messed up :S

  • #4
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Thanked 3 Times in 3 Posts
    EDIT: I have updated the code and question to make it as simple as possible. Any help is appreciated.

    Also, could a mod move this to the PHP forum now that the problem has been narrowed down to PHP?


    Posting Permissions

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