Bonjour tout le monde ,
bon mon problème et comme suit :
j'ai 2 pages 'renvoiSubscribe.php' et 'ACCEUIL.PHP'
'renvoiSubscribe.php' transmet les données vers 'Acceuil.php' par un tableau $_SESSION mais pourtant ça marche pas, ils sont nulls. Veuillez trouver ci-dessous les codes des 2 pages et merci d'avance.
'renvoiSubscribe.php':
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55 <?php session_start(); ?> <!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" /> <title>Document sans nom</title> </head> <body> <?php $con=mysql_connect("localhost","root"); mysql_select_db("infoApp",$con); if ($_POST['password']=='generer') $_POST['password']=uniqid(); else $_POST['password']=$_POST['password1']; mysql_query("INSERT INTO subscribe (nom,prenom,age,pays,email,adresse,password) VALUES ('$_POST[nom]','$_POST[prenom]','$_POST[age]','$_POST[pays]','$_POST[email]','$_POST[adresse]','$_POST[password]')"); $_SESSION['email']=$_POST['email']; $_SESSION['password']=$_POST['password']; $_SESSION['nom']=$_POST['nom']; $_SESSION['prenom']=$_POST['prenom']; echo '<pre> <table border=2> <tr><td>Nom :</td> <td>'.$_POST['nom'].'</td></tr> <tr><td>Prénom :</td> <td>'.$_POST['prenom'].'</td></tr> <tr><td>Age :</td> <td>'.$_POST['age'].'</td></tr> <tr><td>Pays :</td> <td>'.$_POST['pays'].'</td></tr> <tr><td>E-mail :</td> <td>'.$_POST['email'].'</td></tr> <tr><td>Adresse :</td> <td>'.$_POST['adresse'].'</td></tr> <tr><td>Password :</td> <td>'.$_POST['password'].'</td></tr> </table> </pre>'; mysql_close($con); echo "</br><a href='Acceuil.php'>Redirection ........</a>"; echo "<a href='Acceuil.php'></a>"; echo "</a href='googleMaps.php'>"; echo "</a href='subscribe.php'>"; echo "</a href='googleMaps.php'>"; echo "</a href='Projects.php'>"; ?> </body> </html>
'Acceuil.php':
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
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 <!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" /> <title>Document sans nom</title> </head> <body> <?php session_start(); function getParameterSession($str1,$str2){ $var = NULL; if (isset($_SESSION[$str1]) && isset($_SESSION[$str2])) $var = $_SESSION[$str1]; if($_SESSION[$str1]=="" || $_SESSION[$str2]=="") $var = null; return $var; } $testSession=getParameterSession("email","password"); $con=mysql_connect("localhost","root"); mysql_select_db("infoApp",$con); if($testSession !=null) { $result=mysql_query("SELECT * FROM subscribe WHERE email='".$_SESSION['email']."' AND password='".$_SESSION['password']."'"); $row=mysql_fetch_array($result); $nbr=mysql_num_rows($result);} if($nbr > 0 ) echo "Login : ".$row['email']."</br> Bonjour : ".$row['prenom']." , ".$row['nom']; else {echo "erreur!</br><a href='login.php'>Redirection ........</a>";} mysql_close($con); ?> </body> </html>
Partager