Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

emailing variable

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

emailing variable

Postby jesso3 » Fri Mar 14, 2003 9:59 am

Hi. I am having this problem using the email function. I get a cookie and use the value of it to get an array like below: The problem is that when I email the variable, only the last line of the array is sent, not the whole thing. But, everything gets printed on the screen like it should. Can someone help me here? :)
for ($y = 0; $y < 15; $y++) {
$realy=$y+1;
$tempAns= $answers[y];
$tempCorrect= $CorrectAns[y];
//if (strtolower($tempAns)==strtolower($tempCorrect)) {

echo "$speechst Question $realy - Correct.";
//}
//else {
echo "$speechst Question $realy - Incorrect. Actual Answer was :$Explanation[y]";
$ans = "$speechst Question $realy - Incorrect. Actual Answer was :$Explanation[y]";
$body = "$email, $name, $Company, $City, $phone_no, $currentgrade, $currentScore, $ans";
//}
}
//$body = "$email, $name, $Company, $City, $phone_no, $currentgrade, $currentScore, $ans";
$hdr = "From: Infotrends Canada\r\n";
$hdr .= "Return-Path: $someone@somewhere.com\r\n";
if($cc){$hdr .= "Cc: $cc\r\n";}
if($bcc){$hdr .= "Bcc: $bcc\r\n";}
for($i = 0; $i < $sizeof; $i++){
if(mail($to[$i], $subject, $body, $hdr))
{
$status = "Your message was successfully sent.";
}
else
{
$status = "An error occurred while sending your message.";
}
}
Last edited by jesso3 on Thu Mar 20, 2003 2:14 pm, edited 1 time in total.
jesso3
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Feb 17, 2003 4:53 pm

help pls?

Postby jesso3 » Mon Mar 17, 2003 2:17 pm

Since no one replied to my posting as of yet, I am assuming my problem is unsolvable. Thanks anyway.
jesso3
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Feb 17, 2003 4:53 pm

Postby Redcircle » Mon Mar 17, 2003 4:16 pm

sorry.. I had the weedend off this week. :)

If you are going through an array make sure that you use .= if you wish to combine the information of the array together.

Code: Select all
$sizeof = sizeof($new_array('one','two','three'));

for($x=0; $x<$sizeof; $x++)
{

 $output .= $new_array[$x];
}

echo $output;


this will yield

onetwothree

Code: Select all
$sizeof = sizeof($new_array('one','two','three'));

for($x=0; $x<$sizeof; $x++)
{

 $output = $new_array[$x];
//this is the part to pay attention too

}

echo $output;


this will yield just the last of the array.
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

still having same problem

Postby jesso3 » Tue Mar 18, 2003 2:47 pm

Hi. Thanks, but I am still having the same problem of not being able to email all of the output that is echoed on the screen. Any reason why?
jesso3
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Feb 17, 2003 4:53 pm

Postby jesso3 » Thu Mar 20, 2003 12:51 pm

any body know why??
jesso3
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Feb 17, 2003 4:53 pm

Postby jesso3 » Thu Mar 20, 2003 12:52 pm

I had 52 views to my posting and no one can help me??
jesso3
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Feb 17, 2003 4:53 pm

Postby pootergeist » Thu Mar 20, 2003 1:13 pm

well - firstly you haven't indented your code at all well and there's no highlight syntaxing (just makes it trickier).

next - you haven't mentioned why you're sending multiple emails to (I assume) all the addresses in the $to array

next - where does $subject come from?

and lastly - you've ignored the valid advise (let's call it an answer rather than advice as that's what it was) already given.

why should we help if you don't listen?

I'm not even going to mention the commented lines - you probably think they are helpful for anyone trying to help.
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron