how to make to transmit the parameters of a cgi between these various pages I would like to use para

J

john.swilting

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) }
 
A

anno4000

john.swilting said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top