PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Storing values between multiple page forms
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Storing values between multiple page forms

Réponse
 
LinkBack Outils de la discussion
Vieux 11/03/2008, 16h11   #1
Matty Sarro
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Storing values between multiple page forms

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.

  Réponse avec citation
Vieux 11/03/2008, 16h36   #2
Thijs Lensselink
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Storing values between multiple page forms

Quoting Matty Sarro <msarro@gmail.com>:

> 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
  Réponse avec citation
Vieux 11/03/2008, 16h44   #3
Shawn McKenzie
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Storing values between multiple page forms

Matty Sarro 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)
>
> 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.
>

Sessions

-Shawn
  Réponse avec citation
Vieux 11/03/2008, 16h48   #4
Daniel Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Storing values between multiple page forms

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 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 .

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>
  Réponse avec citation
Vieux 11/03/2008, 16h55   #5
Matty Sarro
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Storing values between multiple page forms

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:

> 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 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 .
>
> --
> </Dan>
>
> Daniel P. Brown
> Senior Unix Geek
> <? while(1) { $me = $mind--; sleep(86400); } ?>
>


  Réponse avec citation
Vieux 12/03/2008, 19h37   #6
Jim Lucas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Storing values between multiple page forms

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:
>
>> 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 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 .
>>
>> --
>> </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 s

--
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
  Réponse avec citation
Vieux 12/03/2008, 19h39   #7
Daniel Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Storing values between multiple page forms

On Wed, Mar 12, 2008 at 2:37 PM, Jim Lucas <lists@cmsws.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.


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); } ?>
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h04.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15442 seconds with 15 queries