print all session variables as email message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
djdavedawson
Forum Newbie
Posts: 9
Joined: Tue Jul 29, 2008 10:13 am

print all session variables as email message

Post by djdavedawson »

Im using php mail() to send an email showing form submissions.

Each of the submissions gets a session variable assigned like this:
$_SESSION['product'][0]
$_SESSION['product'][1]
$_SESSION['product'][2]
$_SESSION['product'][3]

Mail portion here:
mail($addr, $submission_subject, $submission_message)

I need to set up the message to show all the variables but I never know how many there will be.

I've tried this but it does not work:
$submission_message = print_r($_SESSION['product']);

It just goes to a white screen and then prints them on screen.

How can i get the session variables values to print as the email message?

Thanks In Advance

DD
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: print all session variables as email message

Post by requinix »

Code: Select all

$submission_message = print_r($_SESSION['product']);
Close. Take a look at print_r's manual page.
Post Reply