Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 13th, 2007, 05:31 PM
Registered User
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dragonedge
Default Form mailer help

I am terribly new to php but I need to write a form mailer that will loop through the form values to grab them and attach them to a single variable, that part is done now what i am having trouble with is I want to make a hidden input in HTML and list required fields and if those fields are not filled, display an error. Maybe I should just paste what I have so far.

HTML example:
 <input type=hidden name="required" value="name,email">
and the PHP:

$form_fields = array_keys($HTTP_POST_VARS);
for ($i = 0; $i < sizeof($form_fields); $i++) {

    $thisField = $form_fields[$i];
    $thisValue = $HTTP_POST_VARS[$thisField];
    $msg .= $thisField . ":" . $thisValue . "\n\n";


$headers ="From:" . $name . "<". $email."> \n";

$to = "me@myemail.com";

function check_Required() {

    $check = explode(",",$required);
        for($i=0; $i<count($check); $i++) {
         $stringToCheck = $check[$i];


function checkInput () {

        if($stringToCheck="" || " ") {
                echo '<script language="JavaScript">alert("Please enter required fields!");

@mail($to, $subject, $msg, $headers);
I'm at a complete loss, any help is much appreciated

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending HTML Mailer With SWF cancer10 Classic ASP Databases 1 November 16th, 2007 08:48 AM
Firefox Error when Form Floated / Form locks socoolbrewster CSS Cascading Style Sheets 5 October 6th, 2007 09:59 PM
ASP Mailer component ratheesh Classic ASP Components 0 November 26th, 2004 04:37 AM
Convert SMTPsvg.Mailer to JavaScript hoffmann Classic ASP Databases 2 August 20th, 2003 10:49 AM
Chapter 15 simple-mailer.php doesn't work Corey Wirun BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 June 18th, 2003 03:13 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.