开发者

variables not printing in email form results

开发者 https://www.devze.com 2023-01-07 03:09 出处:网络
My form validates and submits fine, but the variables are not being printed in the emailed results. Can anyone take a quick look at my processing file and tell me why this might be?

My form validates and submits fine, but the variables are not being printed in the emailed results.

Can anyone take a quick look at my processing file and tell me why this might be?

<?php

// CHANGE THE VARIABLES BELOW



$EmailFrom = $EmailFrom;
$EmailTo = "me@me.com";
$Subject = "Proposal Submission";


$FirstName = $HTTP_POST_VARS['FirstName'];
$LastName = $HTTP_POST_VARS['LastName']; 
$Title = $HTTP_POST_VARS['Title']; 
$Institution = $HTTP_POST_VARS['Institution']; 
$EmailFrom = $HTTP_POST_VARS['EmailFrom']; 
$Phone = $HTTP_POST_VARS['Phone']; 
$Address = $HTTP_POST_VARS['Address']; 
$City = $HTTP_POST_VARS['City']; 
$State = $HTTP_POST_VARS['State']; 
$Zip = $HTTP_POST_VARS['Zip']; 
$CoPresenter = $HTTP_POST_VARS['CoPresenter']; 
$ProgramTitle = $HTTP_POST_VARS['ProgramTitle']; 
$ProgramType = $HTTP_POST_VARS['ProgramType']; 
$ProgramDescription = $HTTP_POST_VARS['ProgramDescription']; 
$ProgramOutline = $HTTP_POST_VARS['ProgramOutline']; 
$ProgramTopic = $HTTP_POST_VARS['ProgramTopic']; 
$ProgramAudience = $HTTP_POST_VARS['ProgramAudience']; 
$ExpectedOutcome = $HTTP_POST_VARS['ExpectedOutcome']; 
$Experience = $HTTP_POST_VARS['Experience']; 
$AVEquipment = $HTTP_POST_VARS['AVEquipment']; 


// prepare email body text
$Body = "";
$Body .= "First Name: ";
$Body .= $FirstName;
$Body .= "\n";
$Body .= "Last Name: ";
$Body .= $LastName;
$Body .= "\n";
$Body .= "Title: ";
$Body .= $Title;
$Body .= "\n";
$Body .= "Institution: ";
$Body .= $Institution;
$Body .= "\n";
$Body .= "EmailFrom: ";
$Body .= $EmailFrom;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Zip: ";
$Body .= $Zip;
$Body .= "\n";
$Body .= "CoPresenter: ";
$Body .= $CoPresenter;
$Body .= "\n";
$Body .= "ProgramTitle: ";
$Body .= $ProgramTitle;
$Body .= "\n";
$Body .= "ProgramType: ";
$Body .= $ProgramType;
$Body .= "\n";
$Body .= "ProgramDescription: ";
$Body .= $ProgramDescription;
$Body .= "\n";
$Body .= "ProgramOutline: ";
$Body .= $ProgramOutline;
$Body .= "\n";
$Body .= "ProgramTopic: ";
$Body .= $ProgramTopic;
$Body .= "\n";
$Body .= "ProgramAudience: ";
$Body .= $ProgramAudience;
$Body .= "\n";
$Body .= "ExpectedOutcome ";
$Body .= $ExpectedOutcome;
$Body .= "\n";
$Body .= "Experience: ";
$Body .= $Experience;
$Body .= "\n";
$Body .= "AVEquipment: ";
$Body .= $AVEquipment;
$Body .= "\n";



// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
// CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?

This is the form:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>Conference</title>
    <link rel="shortcut icon" href="/favicon.ico" >
    <link rel="stylesheet" href="css/stylesheet.css" type="text/css" media="screen" /> 

    <link rel="stylesheet" href="css/page.css" type="text/css" media="screen" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript"></script>


<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/cmxforms.js" type="text/javascript"></script>


<script type= "text/javascript">

function changeInputs()
{
var els = document.getElementsByTagName('input');
var elsLen = els.length;
var i = 0;
for ( i=0;i<elsLen;i++ )
{
if ( els[i].getAttribute('type') )
{
if ( els[i].getAttribute('type') == "text" )
els[i].className = 'text';
else
els[i].className = 'button';
}
}
}

$().ready(function() {

    // validate signup form on keyup and submit
    $("#signupForm").validate({
        rules: {
            Firstname: "required",
            Lastname: "required",
            Institution: "required",            
            EmailFrom: {
                required: true,
                email: true
            },

        },
        messages: {
            Firstname: "Please enter your first name",
            Lastname: "Please enter your last name",
            Institution: "Please enter an Institution name",            

            EmailFrom: "Please enter a valid email address"

        }
    });

});

</script>

<style type="text/css">
#signupForm {}
#signupForm label.error {
    margin-left: 5px;
    padding: 3px;
    width: auto;
    display: inline;
    color: #cc0000;
    font-weight: bold;
    background-color: #dedede;
}

.cmxform p
    {
    display: block;
    }

label
    {
    font: bold 14px/18px Arial;
    margin-top: 10px;
    }

label.small
    {
    font: 12px/18px Arial;
    margin-top: 5px;
    }

label,input.text,span
    {
    display: block;
    }

input.checkbox,.inline
    {
    display: inline
    }

input
    {
    margin-right: 5px;
    }

</style>


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
// End -->
</script>

<?php
include ("google.inc");
?>

</head>

<body>

    <div id="wrapper"><!-- Begin wrapper -->

<?php
include ("header.inc");
?>      
        <hr />

        <div id="outer-space"><!-- Begin outer-space -->

            <div id="hfeed">

                <p id="page-info">Important Information</span>

                <div class="hentry">

                    <div class="entry-meta">
                        <abbr title="#">Conference date: 10/01/10</abbr>
                        <h2 class="entry-title"><a>Directions</a></h2>
                        <em>at</em> <span class="author vcard">Elgin Community College</span>
                    </div>

        <div class="entry-content">

<form name="myform" class="cmxform" id="signupForm" action="proposalengine.php" method="post" enctype="text/plain">
<fieldset>

<label for="FirstName">First Name</label>
<input id="FirstName" name="FirstName" />


<label for="LastName">Last Name</label>
<input id="LastName" name="LastName" />


<label for="Title">Title</label>
<input id="Title" name="Title" />


<label for="Institution">Institution: </label>
<input name="Institution" id="Institution" />


<label for="EmailFrom">Email: </label>
<input id="EmailFrom" name="EmailFrom" class="required email" />


<label for="Phone">Telephone: </label><input name="Phone" id="Phone" type="text" value="" size="10" maxlength="13" />


<label for="Address">Street Address: </label><input name="Address" id="Address" type="text" size="35" maxlength="75" />


<label for="City">City: </label><input name="City" id="City" />

<label class="inline" for="State">State: </label><select class="inline" name="State" id="State">
<option selected value="IL">IL</option>
    <option value="AL">AL</option>
    <option value="AK">AK</option>
    <option value="AZ">AZ</option>
    <option value="AR">AR</option>
    <option value="CA">CA</option>
    <option value="CO">CO</option>
    <option value="CT">CT</option>
    <option value="DE">DE</option>
    <option value="DC">DC</option>
    <option value="FL">FL</option>
    <option value="GA">GA</option>
    <option value="HI">HI</option>
    <option value="ID">ID</option>
    <option value="IN">IN</option>
    <option value="IA">IA</option>
    <option value="KS">KS</option>
    <option value="KY">KY</option>
    <option value="LA">LA</option>
    <option value="ME">ME</option>
    <option value="MD">MD</option>
    <option value="MA">MA</option>
    <option value="MI">MI</option>
    <option value="MN">MN</option>
    <option value="MS">MS</option>
    <option value="MO">MO</option>
    <option value="MT">MT</option>
    <option value="NE">NE</option>
    <option value="NV">NV</option>
    <option value="NH">NH</option>
    <option value="NJ">NJ</option>
    <option value="NM">NM</option>
    <option value="NY">NY</option>
    <option value="NC">NC</option>
    <option value="ND">ND</option>
    <option value="OH">OH</option>
    <option value="OK">OK</option>
    <option value="OR">OR</option>
    <option value="PA">PA</option>
    <option value="RI">RI</option>
    <option value="SC">SC</option>
    <option value="SD">SD</option>
    <option value="TN">TN</option>
    <option value="TX">TX</option>
    <option value="UT">UT</option>
    <option value="VT">VT</opt开发者_运维问答ion>
    <option value="VA">VA</option>
    <option value="WA">WA</option>
    <option value="WV">WV</option>
    <option value="WI">WI</option>
    <option value="WY">WY</option>
</select>
<label class="inline" for="Zip">Zip Code: </label><input class="inline" name="Zip" id="Zip" type="text" value="" size="5" maxlength="10"  />

<label for="CoPresenter">Co-Presenter(s):</label>
<input type="text" name="CoPresenter" id="CoPresenter" class="required" />



<label for="ProgramTitle">Program Title:</label>
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )</font><br>
                <textarea name="message1" id="ProgramTitle" class="required" wrap="physical" rows="10" cols="35" onKeyDown="textCounter(this.form.message1,this.form.remLen,125);" onKeyUp="textCounter(this.form.message1,this.form.remLen,125);"></textarea>
    <br>

<label for="ProgramType">Program Type:</label>
                <span><input type="checkbox" name="ProgramType" value="ConcurrentSession" />Concurrent Session
                <span><input type="checkbox" name="ProgramType" value="RoundtableDiscussion" />Roundtable Discussion
                <span><input type="checkbox" name="ProgramType" value="InstitutionalInitiativeSession" />Institutional Initiative Session



<label for="ProgramDescription">Program Description:</label></td>
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 600 characters. )</font><br>
                <textarea name="message2" id="ProgramDescription" class="required" wrap="physical" rows="10" cols="35" onKeyDown="textCounter(this.form.message2,this.form.remLen,600);" onKeyUp="textCounter(this.form.message2,this.form.remLen,600);"></textarea>
    <br>


<label for="ProgramOutline">Program Outline:</label></td>
                    <font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 1800 characters. )</font><br>
                <textarea name="message3" id="ProgramOutline" class="required" wrap="physical" rows="10" cols="35" onKeyDown="textCounter(this.form.message3,this.form.remLen,1800);" onKeyUp="textCounter(this.form.message3,this.form.remLen,1800);"></textarea>
    <br>



<label for="ProgramTopic">Program Topic:</label>
                <span><input type="checkbox" name="ProgramTopic" value="Common Reading" />Common Reading</span>
                <span><input type="checkbox" name="ProgramTopic" value="Diversity" />Diversity</span>
                <span><input type="checkbox" name="ProgramTopic" value="Nontraditional Students" />Nontraditional Students</span>
                <span><input type="checkbox" name="ProgramTopic" value="Retention" />Retention</span>
                <span><input type="checkbox" name="ProgramTopic" value="Technology" />Technology</span>
                <span><input type="checkbox" name="ProgramTopic" value="Transfer Students" />Transfer Students</span>
                <span><input type="checkbox" name="ProgramTopic" value="Co-curricular programs and activities" />Co-curricular programs and activities</span>
                <span><input type="checkbox" name="ProgramTopic" value="Assessment/Outcomes" />Assessment/Outcomes</span>
                <span><input type="checkbox" name="ProgramTopic" value="Family Members/Parents" />Family Members/Parents</span>
                <span><input type="checkbox" name="ProgramTopic" value="Personal Development" />Personal Development</span>
                <span><input type="checkbox" name="ProgramTopic" value="Research" />Research</span>
                <span><input type="checkbox" name="ProgramTopic" value="Special Populations" />Special Populations</span>
                <span><input type="checkbox" name="ProgramTopic" value="Staff & training for first-year programs/services" />Staff & training for first-year programs/services</span>
                <span><input type="checkbox" name="ProgramTopic" value="Transition" />Transition</span>



<label for="ProgramAudience">Intended Audience:</label>
                <span><input type="checkbox" name="ProgramAudience" value="AcademicAffairsFaculty" />Academic Affairs/Faculty</span>
                <span><input type="checkbox" name="ProgramAudience" value="StudentAffairsDevelopment" />Student Affairs/Development</span>
                <span><input type="checkbox" name="ProgramAudience" value="CommunityCollege" />Community College/2-Year Institutions</span>
                <span><input type="checkbox" name="ProgramAudience" value="GraduateStudents" />Graduate Students</span>
                <span><input type="checkbox" name="ProgramAudience" value="FourYearPublic" />Four-Year Public Institutions</span>
                <span><input type="checkbox" name="ProgramAudience" value="FourYearPrivate" />Four-Year Private Institutions</span>



<label for="ExpectedOutcome">Expected Learning Outcomes:</label>
                <label class="small">List 1-2 expected learning outcomes below. (As a result of attending this session, participants will...)</font></label>
                    <font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 400 characters. )<br>
                <textarea name="message4" id="ExpectedOutcome" class="required" wrap="physical" rows="10" cols="35" onKeyDown="textCounter(this.form.message4,this.form.remLen,400);" onKeyUp="textCounter(this.form.message4,this.form.remLen,400);"></textarea>
    <br>



<label for="Experience">Experience:</label>
                <label class="small">List below any experiences you have related to your topic.</font></label>
                    <font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>
                <textarea name="message5" id="Experience" class="required" wrap="physical" rows="10" cols="35" onKeyDown="textCounter(this.form.message5,this.form.remLen,600);" onKeyUp="textCounter(this.form.message5,this.form.remLen,600);"></textarea>
    <br>



<label for="AVEquipment">Audio/Visual Equipment</label>
                <label class="small">List any audio/visual equipment that you will need for this presentation.</label>
    <font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )</font><br>
                <textarea name="message6" id="AVEquipment" class="required" wrap="physical" rows="10" cols="35" onKeyDown="textCounter(this.form.message6,this.form.remLen,600);" onKeyUp="textCounter(this.form.message6,this.form.remLen,600);"></textarea>
    <br>

</fieldset>


<input class="submit" type="submit" value="Submit" onsubmit="return check();"/>
<input type="Reset" value="Clear" />

</FORM>         

        </div><!-- end entry content -->

                <div class="separator"></div>


<?php
include ("pagenav.inc");
?>              
            </div>

            <hr />


        </div><!-- End outer-space -->

        <hr />

<?php
include ("leftside.inc");
?>
<!-- this is actually the left sidebar -->

        <hr />

    </div><!-- End wrapper -->

</body>
</html>


To help with debugging, you can use error_log and print_r:

error_log(print_r($HTTP_POST_VARS, true), 3, 'error.log');
error_log("Body = $Body\n", 3, 'error.log');

This will provide a dump of HTTP_POST_VARS as well as the final value of the Body variable (to make sure they are what you think they are.

Just an FYI, you should use the system superglobal $_POST instead of $HTTP_POST_VARS to get form data.

Also, make sure to consult the runtime configuration of e-mail in PHP so that you make sure that you can send mail successfully in the first place from the machine running the script.

0

精彩评论

暂无评论...
验证码 换一张
取 消