John Taylor-Johnston wrote:
Patience please :)
See my html below. Basically, if type=checkbox is checked, I'm trying to
build $to string in mail().
parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING
or T_VARIABLE or T_NUM_STRING line 4
How do I rebuild this peice of code to be register_globals=off friendly?
Just when I thought I was getting good. This keeps up, I'm changing back
the php.ini myself.
John
stop using eval()! (you know the film SAW? well it's people
who use too much eval() that end up chained to the raditator)
also find out what the difference is betwewen using single
and double quotes.
also learn how/why to use isset(), and initializing your variables
before using them...
now look at this, I'm pretty sure ti will do what you want:
<?
$to = '';
for ($i = 1; $i <= $_POST["NMax"]; $i++) {
$CheckVariable = isset($_POST["Check$i"]) ? $_POST["Check$i"]: false;
$nameVariable = isset($_POST["name$i"]) ? $_POST["name$i"] : '';
$emailVariable = isset($_POST["email$i"]) ? $_POST["email$i"]: '';
if ($CheckVariable) {
$to .= "\"$nameVariable\" <".$emailVariable.">,";
}
}
echo $to;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php