Re: [PHP] Storing values between multiple page forms

2008-03-12 Thread Jim Lucas

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 [EMAIL PROTECTED] wrote:


On Tue, Mar 11, 2008 at 11:11 AM, Matty Sarro [EMAIL PROTECTED] wrote:

Greets all!
 I am working on a minor project for work for entering inventory

information

 for 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); } ?





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'] = '';

$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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Storing values between multiple page forms

2008-03-12 Thread Daniel Brown
On Wed, Mar 12, 2008 at 2:37 PM, Jim Lucas [EMAIL PROTECTED] 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.

An excellent point, Jim.  I hadn't even thought to mention that,
to be honest.  That should be a great fit for what Matt's working on.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Storing values between multiple page forms

2008-03-11 Thread Matty Sarro
Greets all!
I am working on a minor project for work for entering inventory information
for 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)

From there, create a loop to run through each server based on number of
servers input on first page. Each server will come up as a new page.
Each server can have x hard drives, the number of which will be put in by
the user, and the form will be generated by a loop based on the number the
user puts in (ie: either generate the form based on submitted number of hard
drives, or have user put in a drop down and use some javascript for the
rest).

I'm still planning this out... my major concern is how would I maintain
values between pages? I'd like to have a summary printed before actually
storing values into the database. I'm going to start throwing together some
code, but I just wasn't sure how to maintain the values. The first version
is most likely just going to be one really large form, but obviously this is
going to be ugly and not so easy to work with considering the variances that
the different servers have.

Any suggestions would be welcome.


Re: [PHP] Storing values between multiple page forms

2008-03-11 Thread Thijs Lensselink

Quoting Matty Sarro [EMAIL PROTECTED]:


Greets all!
I am working on a minor project for work for entering inventory information
for 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)

From there, create a loop to run through each server based on number of
servers input on first page. Each server will come up as a new page.
Each server can have x hard drives, the number of which will be put in by
the user, and the form will be generated by a loop based on the number the
user puts in (ie: either generate the form based on submitted number of hard
drives, or have user put in a drop down and use some javascript for the
rest).

I'm still planning this out... my major concern is how would I maintain
values between pages? I'd like to have a summary printed before actually
storing values into the database. I'm going to start throwing together some
code, but I just wasn't sure how to maintain the values. The first version
is most likely just going to be one really large form, but obviously this is
going to be ugly and not so easy to work with considering the variances that
the different servers have.

Any suggestions would be welcome.



Maybe take a look at stut's article :)

http://stut.net/articles/sessionless_sessions.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Storing values between multiple page forms

2008-03-11 Thread Daniel Brown
On Tue, Mar 11, 2008 at 11:11 AM, Matty Sarro [EMAIL PROTECTED] wrote:
 Greets all!
  I am working on a minor project for work for entering inventory information
  for 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); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Storing values between multiple page forms

2008-03-11 Thread Matty Sarro
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 [EMAIL PROTECTED] wrote:

 On Tue, Mar 11, 2008 at 11:11 AM, Matty Sarro [EMAIL PROTECTED] wrote:
  Greets all!
   I am working on a minor project for work for entering inventory
 information
   for 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); } ?