views:

22

answers:

2

Alright, so I got my form to email most of the variables in php. However, my textarea variables show up blank and my textarea inputs print as "Array"

Here is a snippet from my form:

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

Here is the part of the processing file:

$ProgramAudience = $_POST['ProgramAudience']; 
$ExpectedOutcome = $_POST['ExpectedOutcome']; 

...

$Body = "";
$Body .= "ProgramAudience: ";
$Body .= $ProgramAudience;
$Body .= "\n";
$Body .= "ExpectedOutcome ";
$Body .= $ExpectedOutcome;

This is what the emailed result looks like:

From:

To: [email protected]

Date: Thu, 15 Jul 2010 17:10:17 -0400

Subject: Proposal Submission

First Name: miles

Last Name: me

Title: test

Institution: test

EmailFrom: [email protected]

Phone: 8157531503

Address: HSC 023A

City: DeKalb

State: IL

Zip: 60115

CoPresenter: adam

ProgramTitle:

ProgramType: Array

ProgramDescription:

ProgramOutline:

ProgramTopic: Array

ProgramAudience: Array

ExpectedOutcome

Experience:

AVEquipment:

+1  A: 

Check your name attribute on the text area - that's the one PHP will use.

Checkboxes will only come through if they are checked, so make sure you check something. With a name with brackets, like "ProgramAudience[]", the $_POST['ProgramAudience'] variable will either be null or an array. You'll want to check if it's an array, and if so, loop through the contents to generate your email.

Scott Saunders
The textarea name was right on. I changed them when I put in some javascript that would limit the number of characters the user could input. Does anyone know a better way of limiting textarea field input?
miles
no clue about limiting characters
Scott Saunders
+1  A: 

For the checkbox arrays, the processing script needed this:

$ProgramTitle = $_POST['ProgramTitle']; 
foreach($_POST['ProgramType']  as  $value)  {
$check_msg .= "Checked: $value\n";
} 

and this:

$Body .= "ProgramTitle: ";
$Body .= $ProgramTitle;
$Body .= "\n";
$Body .= "ProgramType: ";
$Body .= $check_msg;
miles