Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Session_Variables_Soupermail

Posted on 2004-11-05
6
Medium Priority
?
309 Views
Last Modified: 2006-11-17
Buenos Dias Amigos!

I have a multipage form, quite simple actually... a form (page 1), a summary page (page 2), and a thank you page (page 3). Passing variables from p1 to p2 is established, however, upon finalizing the order in p2 and sending all of the pages content (hidden fields, fields, session variables) the session variables get dropped.

They do not appear in my email template that arrives in my inbox. I am using soupermail, but i do not think that is the problem.

I notced, that in my summary page (p2), where I re-display the users in put (<?php $_POST['VAR_NAME']; ?>) in an actual, editable txtField, that gets submitted and processed correctly. But, if I simply redisplay the sess_var on the page, it does not get submitted.

Any ideas?

Adios Amigos!

PlannettF
0
Comment
Question by:plannett
6 Comments
 
LVL 20

Expert Comment

by:virmaior
ID: 12508698
The session wouldn't follow through an e-mail... other than that, I'm not sure I can understand what you are asking.
0
 
LVL 7

Expert Comment

by:BenMorel
ID: 12512476
Maybe the session is not started in each script. Remember to use session_start() in EACH of them.

There's 2 ways to achieve it with sessions :
1) with session_register()
First script :
<?php
 session_start();
 session_register('var_name');
 $var_name = "value";
?>
Second script :
<?php
 session_start();
 session_register('var_name');
 echo $var_name;
?>

2) with $_SESSION
First script :
<?php
 session_start();
 $_SESSION['var_name'] = "value";
?>
Second script :
<?php
 session_start();
 echo $_SESSION['var_name'];
?>

Note: don't use both session_register() and $_SESSION in the same script.

You can also do it without sessions, with hidden fields :
<input type="hidden" name="var_name" value="<?php echo htmlentities(@$_POST['var_name']); ?>" />

Or, if magic_quotes_gpc is enabled on your server :
<input type="hidden" name="var_name" value="<?php echo htmlentities(stripslashes(@$_POST['var_name')); ?>" />

Regards,
Ben
0
 

Author Comment

by:plannett
ID: 12523438
Page 1 has session start and session is started on the second page. Third page does not require it, as it is simply a "Thank you" page.

All of the data I am seeking to submit exists in page 2. Remember, in my original post, i stated that page 1 is the form, page 2 is a summary of 1 and that everything carried over just fine.

I think where I am confused is: do session_variables get submitted to soupermail when the user hits the submit button?

Apparently not, because nothing carries over into the results of the script.

Page 3 is irrelevant, it's a success page that gets called from a hidden value in page 2.

Thanks
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 20

Accepted Solution

by:
virmaior earned 150 total points
ID: 12523693
I don't think session variables would carry into the perl script (soupemail).  You need to include the data as POST variables.  While it will be in the same session, I don't think soupemail is designed to take its values from SESSION vars.  So you'll need to include them in the post data being sent.  If you don't want the user to see them, use: "<INPUT type="hidden" value='your value'>

The manual seems to suggest that you can use $cookie_* for cookies (e.g. not $x but $cookie_x to get to the cookie x).  You might be able to use $cookie_ for session variables. g/l.

(from the manual):
If you want to check on cookies, prefix the cookie's name with $cookie_.
http://soupermail.sourceforge.net/manual.html
0
 
LVL 2

Expert Comment

by:ramonklown
ID: 12523978
just user your own PHP mail function
http://br2.php.net/manual/en/function.mail.php

example:
<?
session_start()
$_SESSION['email_add'] = $_SESSION['email_add'];

$message = 'Thanks for shopping';

if (mail( $_SESSION['email_add'], "the subject", $message,
     "From: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
     "Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
     "X-Mailer: PHP/" . phpversion())){
echo 'success on mail send';
}
else { echo 'error on sending mail'; }

?>
0
 
LVL 25

Expert Comment

by:Marcus Bointon
ID: 12524695
PHP's implementation of sessions will be different to what you'll find in Perl, so session vars will not be available to Perl if you created them from PHP - unless there is a PHP_Session package in CPAN somewhere?

mail() is worth avoiding, especially on Windows. Use phpmailer instead:

http://phpmailer.sourceforge.net/
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question