PHP Array not saving entire string
Posted: Wed Jun 06, 2007 8:27 pm
feyd | Please use
In case it's needed, here's the PHP file that sends the email:
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
First, thanks in advance for any help that I can get with this.
I'm having a problem with assigning string values to an array. The project I'm working on sends an email from Flash using PHP. The email sends just fine, however the values that appear in the email don't appear correct.
The following is the code that assigns the values. For some reason when I set the email to just send $bentonArray[0] the only thing that appears in the email is an "E" instead of "Easel Chartpad". However I tell the email to display $bentonArray[0] and $bentonArray[1] it displays "Ea".
I've been through tons of websites and FAQs about arrays in PHP and don't see what I'm doing wrong.Code: Select all
<?php
$bentonArray = array();
$i = 0;
if($eq001_benton.selected == true)
{
$bentonArray[$i] = "Easel Chartpad";
$i++;
}
if ($eq002_benton.selected == true)
{
$bentonArray[$i] = "Laser Pointer";
$i++;
}
if ($eq003_benton.selected == true)
{
$bentonArray[$i] = "Wireless PC Remote";
$i++;
}
if ($eq004_benton.selected == true)
{
$bentonArray[$i] = "Wireless High Speed Internet";
$i++;
}
if ($eq005_benton.selected == true)
{
$bentonArray[$i] = "Laptop";
$i++;
}
if ($eq006_benton.selected == true)
{
$bentonArray[$i] = "VHS Camcorder w/Tripod";
$i++;
}
if ($eq007_benton.selected == true)
{
$bentonArray[$i] = "3'x5' Whiteboard & Markers";
$i++;
}
if ($eq008_benton.selected == true)
{
$bentonArray[$i] = "Network Switches";
$i++;
}
if ($ost001_benton.selected == true)
{
$bentonArray[$i] = "Onsite Technician (Mon-Fri)";
$i++;
}
if ($ost002_benton.selected == true)
{
$bentonArray[$i] = "Onsite Technician (Sat & Sun)";
$i++;
}
if ($proj001_benton.selected == true)
{
$bentonArray[$i] = "61-inch Plasma Digital TV";
$i++;
}
if ($proj002_benton.selected == true)
{
$bentonArray[$i] = "35mm Slide Projector";
$i++;
}
if ($proj003_benton.selected == true)
{
$bentonArray[$i] = "DVD/VCR Player";
$i++;
}
if ($ac001_benton.selected == true)
{
$bentonArray[$i] = "Polycom Conference Phone";
$i++;
}
if ($ac002_benton.selected == true)
{
$bentonArray[$i] = "Long Distance Calls";
$i++;
}
if ($ac003_benton.selected == true)
{
$bentonArray[$i] = "Local Calls";
$i++;
}
if ($oe001_benton.selected == true)
{
$bentonArray[$i] = "VGA/Audtio Extension Cables";
$i++;
}
if ($oe002_benton.selected == true)
{
$bentonArray[$i] = "Handheld Crestron";
$i++;
}
if ($oe003_benton.selected == true)
{
$bentonArray[$i] = "In-Table Data/Power Mounts";
$i++;
}
if ($oe004_benton.selected == true)
{
$bentonArray[$i] = "2 Power Strips";
$i++;
}
if ($oe005_benton.selected == true)
{
$bentonArray[$i] = "Data Cables";
$i++;
}
?>Code: Select all
<?php
$to = "digitalphoenixx@gmail.com";
$msg = "$name\n\n";
$msg .= "$message\n\n";
$msg .= $bentonArray[0];
mail($to, $subject, $msg, "From: Website Correspondence\nReply-To: $email\n");
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]