Passer une variable d'une page à une autre
Bonjour.
J'essaie de passer une variable d'une page A à une page B mais si il y a une erreur de saisie sur la B je perds la variable quand je valide
la page A
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<script type="text/javascript">
function affect(id)
{
document.selection.action.value = id;
document.selection.submit();
}
</script>
<form name="identification" method="POST" action="index.php?page=jury">
<table border="0" align="center" width="450px">
<tr>
<td colspan="2" align="center" height="40px">Mot de passe oublié ou perdu, cliquez <a href="#" onclick="javascript:affect(1);" style="color:blue"><b>ici</b></a>.<br />
Pour changer de nom utilisateur et/ou de mot de passe, cliquez <a href="#" onclick="javascript:affect(2);" style="color:blue"><b>ici</b></a>.</td>
</tr>
</table>
</form>
<form name="selection" method="POST" action="index.php?page=tete">
<input type="text" name="action" value="">
</form> |
la page B. L'affichage est bien ce qui doit s'afficher mais quand je clique sur le bouton de validation je perds la variable $_SESSION si il y a une erreur
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <?php
require('connect.php');
require('fonctionsphp.php');
if (isset($_POST['action'])){
$choix=$_POST['action'];
}
if ($_SESSION['action']==1){
//traitement
<div align="center" style="background-color:#CCFFFF; height:400px">
<br />
<p align="center">Pour recevoir un nouveau mot de passe, merci de compléter le formulaire.</p><br />
<form name="perdu" method="POST" action="index.php?page=tete">
<table border="0">
<tr height="35px">
<td colspan="2" align="center"><input type="submit" name="envoi_perdu" value="Envoyer">
</tr>
</table>
</form>
</div>
<?php
if (isset($_POST['envoi_perdu'])){
// traitement
}
}
else if ($_SESSION['action']==2){
?><div align="center" style="background-color:#CCFFFF; height:400px">
<br />
<p align="center">Pour changer votre nom utilisateur et/ou votre mot de passe, merci de compléter le formulaire.</p><br />
<form name="changer" method="POST" action="index.php?page=tete">
<table border="0" align="center">
<tr height="35px">
<td colspan="2" align="center"><input type="submit" name="envoi_changer" value="Modifier">
</tr>
</table>
</form>
</div>
<?php
if (isset($_POST['envoi_changer'])){
//traitement
}
} |
Est ce que quelqu'un peut me guider.
Merci d'avance