Re: Storing values between multiple page forms
| From: | Jim Lucas | Date: | Wed, 12 Mar 2008 18:37:10 +0000 |
| Subject: | Re: Storing values between multiple page forms | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-271415@lists.php.net to get a copy of this message | ||
Matty Sarro wrote:
Yeah, I'm working on this with the hopes of it turning into a full module for a larger project I'm working on... but I'm still a bit of a noob :) Thanks for the assistance guys! On Tue, Mar 11, 2008 at 11:48 AM, Daniel Brown <parasane@gmail.com> wrote:If you are going to follow Daniel's example, since you could potentially be working with more then one server on any given order, you might want to look at using a multi-dimensional array to store your values in. $_SESSION['order_info'] = array(); $_SESSION['order_info']['customer_data'] = array(); $_SESSION['order_info']['customer_data']['name'] = '';On Tue, Mar 11, 2008 at 11:11 AM, Matty Sarro <msarro@gmail.com> wrote:Greets all! I am working on a minor project for work for entering inventoryinformationfor servers we ship out. Here is my plan: First page - Get client name, number of servers, and find number of miscellaneous equipment(s) being shipped (UPS's, monitors, etc)[snip!]I'm still planning this out... my major concern is how would I maintain values between pages?<?php session_start(); $_SESSION['value'] = $your_sanitized_value_from_POST; $_SESSION['value2'] = $your_second_sanitized_value; echo "<pre />\n"; print_r($_SESSION); echo "</pre>\n"; ?> RTFM: http://php.net/session Keep in mind, it'll only work on the same server and same domain. Otherwise, you may want to look into using wildcard cookies. -- </Dan> Daniel P. Brown Senior Unix Geek <? while(1) { $me = $mind--; sleep(86400); } ?>
$contact_data = array(); $contact_data['type'] = 'billing'; $contact_data['address'] = '123 Someplace Ave'; $contact_data['city'] = 'New York'; $contact_data['state'] = 'NY';$contact_data['phone_number'] = '2134526523'; $_SESSION['order_info']['customer_data']['contact_data'][0] = $contact_data;
$contact_data = array(); $contact_data['address'] = 'shipping'; $contact_data['city'] = '321 Somewhere Ave'; $contact_data['state'] = 'New York'; $contact_data['state'] = 'NY';$contact_data['phone_number'] = '2134526523'; $_SESSION['order_info']['customer_data']['contact_data'][1] = $contact_data; $server['make'] = 'Dell'; $server['model'] = 'Power Edge 2400'; $server['ram'] = '2gig';
$server['hd'] = '6x18g Seagate U320 SCSI';$server['video'] = '64 ATI';
$_SESSION['order_info']['servers'][0] = $server;$server['make'] = 'Dell'; $server['model'] = 'Power Edge 2600'; $server['ram'] = '2gig';
$server['hd'] = '3x36g Seagate U320 SCSI';$server['video'] = '64 ATI';
$_SESSION['order_info']['servers'][1] = $server;As you might have guessed, I like arrays. I would actually go as far as making arrays out of the ram, hd, etc... data. This would allow me to have detailed information about each section/option. Hope this helps -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare