PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.comp.lang.php > Automatically create form containing all POST variables?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Automatically create form containing all POST variables?

Réponse
 
LinkBack Outils de la discussion
Vieux 12/06/2007, 08h23   #1 (permalink)
John Geddes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Automatically create form containing all POST variables?

Is there a simple way to have a php page create anew form containing
the full set of POST variables received from submitting the previous
page - without knowing what the names of the fields will be or how
many there will be?

I am developing a page which normally self-submits (ie the form submit
action points to $_SERVER['PHP_SELF']). That is working fine, BUT if
the user has dawdled a long time on the page, I will need to route the
submit via a re-log-in page - without losing the update data that is
held in the form variables. The re-log-in page would then submit its
form data back to the main page as if it had self-referred (with the
difference that the login data at the server will have been refreshed)

I know I could use use php to hard-code each POST variable that the re-
login page will receive - but I rather suspect there is an easier way.

Suggestions, please

John Geddes

  Réponse avec citation
Vieux 12/06/2007, 11h19   #2 (permalink)
Armand Brahaj
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Automatically create form containing all POST variables?

John Geddes wrote:
> Is there a simple way to have a php page create anew form containing
> the full set of POST variables received from submitting the previous
> page - without knowing what the names of the fields will be or how
> many there will be?
>
> I am developing a page which normally self-submits (ie the form submit
> action points to $_SERVER['PHP_SELF']). That is working fine, BUT if
> the user has dawdled a long time on the page, I will need to route the
> submit via a re-log-in page - without losing the update data that is
> held in the form variables. The re-log-in page would then submit its
> form data back to the main page as if it had self-referred (with the
> difference that the login data at the server will have been refreshed)
>
> I know I could use use php to hard-code each POST variable that the re-
> login page will receive - but I rather suspect there is an easier way.
>
> Suggestions, please
>
> John Geddes
>

Hint:
$_POST is an array of all the values coming from the post method!
you can try a

reset($_POST);
while (list($key, $val) = each($_POST)) {
echo '<input type="text" name="'.$key.'" value="'.$val.'">';
}
maybe you should manually exclude the submit value (the input button)
from this loop.
Basically sth like:
if ($key=="submit")
echo '<input type="submit" value="'.$val.'">';
  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 03h42.


Édité par : vBulletin® version 3.7.2
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
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07444 seconds with 10 queries