Before I travel down the path of using session variables, is it possible to store a variable as a session param from one page and access it again from a different page? I'm assuming I would have to forward the session ID to the target URL with GET or POST. I was passing a simple hidden form value for a customer name using GET and a CGI Redirect. Then I parsed the QUERY_STRING to get the customer name and stored it to a variable. However, when I reload the page, that variable changes because the QUERY_STRING changes. So I'm looking to store the customer name to a session table in MySQL and reference it from the second page. So again, do I just pass the session ID via GET or POST and store it as a variable on the target page?
Regards,
Scott
First page passes the customer name to the second page:
$redirURL = "http://localhost/cgi-bin/add_building_names.cgi?customer=
+$post_new_customer";
print $q->redirect(-URL => $redirURL);
The second page picks up this variable and stores it:
my @values = split(/=/,$ENV{QUERY_STRING});
my $customer_get = $values[1];
I then had to use hidden fields and POST to allow this name to persist across reloads. I think storing it as a session variable and/or local cookie would be better. I'm just trying to understand how to reference that variable from the second page.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.