Précédent   Forum des professionnels en informatique > PHP > Langage
Langage Forum sur le langage PHP, la POO, les conventions, la sécurité, etc. Avant de poster : FAQ Langage, toutes les FAQ PHP, cours langage et sources PHP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 04/12/2011, 13h38   #1
Candidat au titre de Membre du Club
 
Inscription : mars 2009
Messages : 138
Détails du profil
Informations forums :
Inscription : mars 2009
Messages : 138
Points : 10
Points : 10
Par défaut Redirection en PHP

Bonjour
s'il vous plait j'ai un souci de redirection en php

j'ai deux pages la première redirige vers la seconde avec cette instruction
Code :
header('Location:commande.php?nom='.$tab[1]);
dans la seconde quand j'affiche avec cette instruction
j'ai cette erreur
Code :
( ! ) Notice: Undefined variable: nom n C:\wamp\www\tpPhp\tp8-php\solutions\commande.php on line 9
je comprend pas

voici tout ma page
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
42
43
44
45
46
47
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="commande.css" rel="stylesheet" type="text/css" />
<title>Commande  en ligne</title>
</head>
<body>
   <div id="princ">
      <div class="descindex">Service de Commande en Ligne</div>
      <hr  id="hc"/>
      <form action="" method="post" name="findex">
       <div id="tid">Entrez votre numéro d'adhérent :</div><input type="password" id="identifiant" name="identifiant" maxlength="8" />
 
       <input type="submit" value="Valider" name="valider" id="val" />
      </form>
   </div>
   <?php
   $cmpte=0;
   if(isset($_POST['valider'])){
    $idf=$_POST['identifiant'];
     if (($idf=="")||(strlen($idf)<8)){
       echo '<span class="erreur">Merci de saisir un identifiant de 8 caracteres</span>';
	  }else{
			if($pf=fopen('com.txt','r')){
			   while(!feof($pf)){
			   		$ligne=fgets($pf);
					if(preg_match('`'.$idf.'`',$ligne)){
					  $cmpte++;
					  $tab=preg_split("/[#]/",$ligne);
					 }				
			   }
			    echo $tab[0];
				echo $tab[1]; 
			  fclose($pf);
			  if($cmpte==1){
			    //header('Location:commande.php?nom='.$tab[1]);
			  }else{header('Location:erreur.php');}
			}else{
			  echo 'ouverture imposible';
			}
 
	  }
   }
   ?>
</body>
</html>
patricx est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/12/2011, 13h49   #2
Membre confirmé
 
Homme Arnaud
Inscription : décembre 2004
Messages : 167
Détails du profil
Informations personnelles :
Nom : Homme Arnaud
Âge : 40
Localisation : France, Rhône (Rhône Alpes)

Informations forums :
Inscription : décembre 2004
Messages : 167
Points : 238
Points : 238
Bonjour,

Dans la seconde, fais plutôt un
Code :
<?php echo $_GET['nom']; ?>
__________________
NginX, SphinxSearch Addict !!
lenono est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/12/2011, 13h56   #3
Candidat au titre de Membre du Club
 
Inscription : mars 2009
Messages : 138
Détails du profil
Informations forums :
Inscription : mars 2009
Messages : 138
Points : 10
Points : 10
Citation:
Envoyé par lenono Voir le message
Bonjour,

Dans la seconde, fais plutôt un
Code :
<?php echo $_GET['nom']; ?>
Merci c'est resolu
patricx est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 18h12.


 
 
 
 
Partenaires

Hébergement Web