Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > how to make to transmit the parameters of a cgi between these various pages I would like to use param but I do not see how to make

Reply
Thread Tools

how to make to transmit the parameters of a cgi between these various pages I would like to use param but I do not see how to make

 
 
john.swilting
Guest
Posts: n/a
 
      03-27-2007

my cgi functions on several windows.I' would like to be able to recover the
parameter $image which comes from the form of the gallery photographs of
the first window towards the second window and the third window.I know
there is the instruction param, but I do not manage to use it in my cgi
my code functions well and it compiles without warnings
#!/usr/bin/perl -w
use diagnostics;
use strict;
use CGI qw(:standard escapeHTML);
use CGI::Carp qw(fatalsToBrowser);

my $cgi;
my $key;
my %etats;
my $ecran_actuel;

$cgi = new CGI;

%etats = (
'defaut' =>\&commander,
'saisie_commande' =>\&saisie_commande,
'validation_commande' =>\&validation_commande,
);
$ecran_actuel = param(".Etat") || "defaut";
die "Pas d'ecran pour $ecran_actuel" unless $etats{$ecran_actuel};


## engendre le document courant
en_tete_standard();
while ( my ($nom_ecran,$fonction) = each %etats){
$fonction->($nom_ecran eq $ecran_actuel);
}

pied_de_page_standard();

################################################## ######################
## fonctions d en tete , de pied de page ,de menu ################
################################################## ######################

sub en_tete_standard {
print header(),
start_html(-Title => "commande" , -BGCOLOR=>"White");
print start_form();
}


sub pied_de_page_standard{ print end_form(),end_html() }


sub menu_boutique{
print p(defaults("vider mon cadie"),
vers_doc("saisie_commande"));
}

sub commander {
my($actif) = @_;
return unless $actif;
my $image = param ('image');
if ( $image == '') {
die "error";
}
print "<H1>salut !</H1>\n";
print p("bienvenue dnas notre magasin de peintures !");
print p("vous avez selectionner la
peintures ",tt(escapeHTML($image)),"\n");

menu_boutique();
return $image;
}
sub saisie_commande {
my $actif = shift;
## my($image) = main::commander;
my @gadgets = qw(Nom Adresse Ville Code_postal Pays Telephone Mail);
unless ( $actif ) {
print map { hidden($_) } @gadgets;
return;
}
print p("Tous les champs sont obligatoires sinons votre commande ne sera
pas valable");
print p("vous pouvez remplir au choix votre numero de telephone ou votre
mail pour le suivie de la commande");
## print p("image ",tt(escapeHTML($image)));
print pre ( p ("Nom\&nbsp;: ",textfield("Nom")),
p ("Adresse\&nbsp;: ",textfield("Adresse")),
p ("Ville\&nbsp;: ",textfield("Ville")),
p ("Code Postal\&nbsp;: ",textfield("Code_postal")),
p ("Pays\&nbsp;: ",textfield("Pays")),
p ("Telephone\&nbsp;: ",textfield("Teléphone")),
p ("e-mail\&nbsp;: ",textfield("Mail")));

print p ( "Selectionner validation_commande pour commander\n",
"la peintures. autrement selectionner Annulation\n");

print p ( vers_doc("validation_commande"), vers_doc("Annulation"));
}

sub validation_commande {
my $actif = shift;
unless ( $actif) {
return;
}
my $numero_commande = time;
my $nom = param ('Nom');
my $adresse = param ('Adresse');
my $ville = param ('Ville');
my $code_postal = param ('Code_postal');
my $pays = param ('Pays');
my $telephone = param ('Teléphone');
my $mail = param ('Mail');
print h1("Commander !");
print p("vous aller recevoir un e-mail avec un numero de commande");
print p("vous serez prevenue quand le paquet sera posté");
print p("dans toutes correspondance indiquer votre numero de
commande",tt(escapeHTML($numero_commande)));
print p("debug ",tt(escapeHTML($nom)));
print p("debug ",tt(escapeHTML($adresse)));
print p("debug ",tt(escapeHTML($ville)));
print p("debug ",tt(escapeHTML($pays)));
print p("debug ",tt(escapeHTML($telephone)));
print p("debug ",tt(escapeHTML($mail)));
print p(defaults("Retour au debut"));
}
sub vers_doc { submit (-NAME => ".Etat", -VALUE => shift) }

 
Reply With Quote
 
 
 
 
anno4000@radom.zrz.tu-berlin.de
Guest
Posts: n/a
 
      03-27-2007
john.swilting <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>
> my cgi functions on several windows.I' would like to be able to recover the
> parameter $image which comes from the form of the gallery photographs of
> the first window towards the second window and the third window.


You can use hidden fields to pass parameters from one invocation to
the next. (In fact, you already seem to do that in another place.)
So add a hidden field "image" to those forms that don't already have
it.

print hidden('image', $image);

Then "my $image = param( 'image')" will restore the value.

Anno
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
HTML::Template->param() : You gave me an odd number of parameters to param()! Dave Perl Misc 5 04-26-2011 02:44 AM
WG 121 will transmit but not receive armfarm@gmail.com Wireless Networking 0 03-04-2006 01:40 PM
perl/cgi exploit with bracketed module names passed in as CGI param shumsta Perl Misc 1 07-21-2005 11:30 PM
XSLT: How to replace param name with this param's value ? Geathaa XML 2 07-30-2003 06:48 AM



Advertisments