Erreur php
gbemich
-
Nabla's Messages postés 20731 Statut Contributeur -
Nabla's Messages postés 20731 Statut Contributeur -
Bonjour,
je développe un site web et pour le lancer j'appelle une page dans l'index et les autres liens me permettent d'afficher d'autres pages.Seulement quand je lance l'index il y a une notice qui s'affiche m'indiquant que j'ai pas déclaré p:
Voici le code de l'index:
<?php
session_start();
header("Cache-control: private");
?>
<?php
require("dbconnect.php");
$db = new dbconnect();
$db->connect();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Acceuil</title>
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Style3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #800000;
}
-->
</style>
<script language="JavaScript" src="calendar1.js"></script>
</head>
<body bgcolor="#336699">
<?php
if(isset($_GET['$p'])){
$p=$_GET['$p'];
}
?>
</head>
<body bgcolor="#336699">
<table height="1" cellSpacing="0" cellPadding="0" width="705" align="center" border="0">
<tbody>
<tr>
<td align="middle" width="705" bgColor="#cadcee" height="1">
<table style="BORDER-COLLAPSE: collapse" borderColor="#0099cc" height="1" cellSpacing="0" cellPadding="0" width="750" bgColor="#ffffff" border="1">
<tbody>
<tr>
<td vAlign="top" align="middle" bgColor="#003366" height="1">
<table id="AutoNumber2" style="BORDER-COLLAPSE: collapse" borderColor="#111111" height="15" cellSpacing="3" cellPadding="0" width="102%" border="0">
<tbody>
<tr>
<td width="100%" bgColor="#003366" colSpan="3" height="1">
<div align="left">
<table border="0" width="100%" height="89">
<tr>
<td width="100%" background="orange.gif" height="21"> </td>
</tr>
<tr>
<td width="100%" height="62"><p align="right"> <img src="btn-volshotel.gif" width="162" height="101"> <img src="vols-hp_02.gif" width="489" height="78">
<div align="center">
<center>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" bgcolor="#0080FF"><p align="left" class="Style3"> KAISER VOYAGES...</p>
<p align="right" class="Style3">...COMME DANS VOS REVES </p>
<div align="center"> </div>
</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
<tr>
<td width="100%" background="orange.gif" height="1"><div align="right"><strong><a href="<?php echo 'index.php?$p=33' ?>">Contacts</a></strong></div></td>
</tr>
</table>
</div>
</td>
</tr>
<center>
<tr>
<td vAlign="top" width="22%" bgColor="#003366" height="175">
<table border="0" width="100%">
<tr>
<td width="100%">
<?php include("includmenu.php"); ?></td>
</tr>
</table>
</td>
</center>
<td vAlign="top" width="100%" bgColor="#FFFFFF" height="87">
<center>
<div align="left">
<?php
switch($p){
case 1:include("p1.php"); break;
case 2:include("p2.php"); break;
case 3:include("p3.php"); break;
case 4:include("p4.php"); break;
case 5:include("p5.php"); break;
case 6:include("p6.php"); break;
case 7:include("p7.php"); break;
case 8:include("p8.php"); break;
case 9:include("p9.php"); break;
case 10:include("p10.php"); break;
case 11:include("p11.php"); break;
case 12:include("p12.php"); break;
case 13:include("p13.php"); break;
case 14:include("p14.php"); break;
case 15:include("p15.php"); break;
case 16:include("p16.php"); break;
case 17:include("p17.php"); break;
case 18:include("p18.php"); break;
case 19:include("p19.php"); break;
case 20:include("p20.php"); break;
case 21:include("p21.php"); break;
case 22:include("p22.php"); break;
case 23:include("p23.php"); break;
case 24:include("p24.php"); break;
case 25:include("p25.php"); break;
case 26:include("p26.php"); break;
case 27:include("p27.php"); break;
case 28:include("p28.php"); break;
case 29:include("p29.php"); break;
case 30:include("p30.php"); break;
case 31:include("p31.php"); break;
case 32:include("p32.php"); break;
case 33:include("p33.php"); break;
case 34:include("p34.php"); break;
case 35:include("p35.php"); break;
case 36:include("includmenu.php"); break;
case 37:include("menu2.php"); break;
case 38:include("menu3.php"); break;
default:include("p1.php"); break;
}
?>
</div>
</center>
</td>
</tr>
</tbody>
</table>
<table border="0" width="100%">
<tr>
<td width="100%" background="orange.gif">
<p align="center"><font size="2">All Rights Reserved-Copyright 2009 </font></td>
</tr>
</table>
</table>
</table>
</body>
Et voici l'erreur qui vient kan g lance le site:
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 98
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 99
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 100
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 101
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 102
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 103
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 104
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 105
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 106
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 107
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 108
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 109
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 110
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 111
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 112
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 113
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 114
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 115
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 116
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 117
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 118
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 119
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 120
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 121
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 122
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 123
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 124
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 125
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 126
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 127
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 128
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 129
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 130
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 131
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 132
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 133
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 134
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 135
la page s'affiche après.
SVP aidez moi
je développe un site web et pour le lancer j'appelle une page dans l'index et les autres liens me permettent d'afficher d'autres pages.Seulement quand je lance l'index il y a une notice qui s'affiche m'indiquant que j'ai pas déclaré p:
Voici le code de l'index:
<?php
session_start();
header("Cache-control: private");
?>
<?php
require("dbconnect.php");
$db = new dbconnect();
$db->connect();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Acceuil</title>
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Style3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #800000;
}
-->
</style>
<script language="JavaScript" src="calendar1.js"></script>
</head>
<body bgcolor="#336699">
<?php
if(isset($_GET['$p'])){
$p=$_GET['$p'];
}
?>
</head>
<body bgcolor="#336699">
<table height="1" cellSpacing="0" cellPadding="0" width="705" align="center" border="0">
<tbody>
<tr>
<td align="middle" width="705" bgColor="#cadcee" height="1">
<table style="BORDER-COLLAPSE: collapse" borderColor="#0099cc" height="1" cellSpacing="0" cellPadding="0" width="750" bgColor="#ffffff" border="1">
<tbody>
<tr>
<td vAlign="top" align="middle" bgColor="#003366" height="1">
<table id="AutoNumber2" style="BORDER-COLLAPSE: collapse" borderColor="#111111" height="15" cellSpacing="3" cellPadding="0" width="102%" border="0">
<tbody>
<tr>
<td width="100%" bgColor="#003366" colSpan="3" height="1">
<div align="left">
<table border="0" width="100%" height="89">
<tr>
<td width="100%" background="orange.gif" height="21"> </td>
</tr>
<tr>
<td width="100%" height="62"><p align="right"> <img src="btn-volshotel.gif" width="162" height="101"> <img src="vols-hp_02.gif" width="489" height="78">
<div align="center">
<center>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" bgcolor="#0080FF"><p align="left" class="Style3"> KAISER VOYAGES...</p>
<p align="right" class="Style3">...COMME DANS VOS REVES </p>
<div align="center"> </div>
</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
<tr>
<td width="100%" background="orange.gif" height="1"><div align="right"><strong><a href="<?php echo 'index.php?$p=33' ?>">Contacts</a></strong></div></td>
</tr>
</table>
</div>
</td>
</tr>
<center>
<tr>
<td vAlign="top" width="22%" bgColor="#003366" height="175">
<table border="0" width="100%">
<tr>
<td width="100%">
<?php include("includmenu.php"); ?></td>
</tr>
</table>
</td>
</center>
<td vAlign="top" width="100%" bgColor="#FFFFFF" height="87">
<center>
<div align="left">
<?php
switch($p){
case 1:include("p1.php"); break;
case 2:include("p2.php"); break;
case 3:include("p3.php"); break;
case 4:include("p4.php"); break;
case 5:include("p5.php"); break;
case 6:include("p6.php"); break;
case 7:include("p7.php"); break;
case 8:include("p8.php"); break;
case 9:include("p9.php"); break;
case 10:include("p10.php"); break;
case 11:include("p11.php"); break;
case 12:include("p12.php"); break;
case 13:include("p13.php"); break;
case 14:include("p14.php"); break;
case 15:include("p15.php"); break;
case 16:include("p16.php"); break;
case 17:include("p17.php"); break;
case 18:include("p18.php"); break;
case 19:include("p19.php"); break;
case 20:include("p20.php"); break;
case 21:include("p21.php"); break;
case 22:include("p22.php"); break;
case 23:include("p23.php"); break;
case 24:include("p24.php"); break;
case 25:include("p25.php"); break;
case 26:include("p26.php"); break;
case 27:include("p27.php"); break;
case 28:include("p28.php"); break;
case 29:include("p29.php"); break;
case 30:include("p30.php"); break;
case 31:include("p31.php"); break;
case 32:include("p32.php"); break;
case 33:include("p33.php"); break;
case 34:include("p34.php"); break;
case 35:include("p35.php"); break;
case 36:include("includmenu.php"); break;
case 37:include("menu2.php"); break;
case 38:include("menu3.php"); break;
default:include("p1.php"); break;
}
?>
</div>
</center>
</td>
</tr>
</tbody>
</table>
<table border="0" width="100%">
<tr>
<td width="100%" background="orange.gif">
<p align="center"><font size="2">All Rights Reserved-Copyright 2009 </font></td>
</tr>
</table>
</table>
</table>
</body>
Et voici l'erreur qui vient kan g lance le site:
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 98
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 99
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 100
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 101
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 102
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 103
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 104
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 105
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 106
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 107
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 108
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 109
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 110
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 111
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 112
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 113
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 114
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 115
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 116
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 117
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 118
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 119
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 120
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 121
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 122
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 123
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 124
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 125
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 126
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 127
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 128
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 129
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 130
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 131
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 132
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 133
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 134
Notice: Undefined variable: p in C:\wamp\www\agence_voyage\index.php on line 135
la page s'affiche après.
SVP aidez moi
A voir également:
- Erreur php
- Expert php pinterest - Télécharger - Langages
- Erreur 0x80070643 - Accueil - Windows
- Erreur 4201 france tv ✓ - Forum Réseaux sociaux
- Erreur 4101 france tv - Forum Lecteurs et supports vidéo
- Code erreur f3500-31 ✓ - Forum Bbox Bouygues
7 réponses
<?php if(isset($_GET['$p'])){ $p=$_GET['$p']; } ?>ce que tu mets entre les crochets n'est pas une variable mais une clé pour un tableau associatif et une valeur pour un tableau simple. Tu ne dois donc pas mettre $p mais p
<?php echo 'index.php?$p=33'; ?>Tu ne doit pas mettre le signe dollar !
je pense qu'il faut modifier ca:
<?php
if(isset($_GET['$p'])){
$p=$_GET['$p'];
}
?>
en ca
<?php
if(isset($_GET['p'])){
$p=$_GET['p'];
}
else
$p=1;//la valeur par défaut
?>
<?php
if(isset($_GET['$p'])){
$p=$_GET['$p'];
}
?>
en ca
<?php
if(isset($_GET['p'])){
$p=$_GET['p'];
}
else
$p=1;//la valeur par défaut
?>
Deja <a href="<?php echo 'index.php?$p=33' ?>">Contacts</a> enleve le $ devant ton p il ne sert à rien
il faut que tu déclares ton $p avant ton $_GET pour qu'il renvoie à une page par defaut. car si $_GET['p'] n'existe pas alors ton $p non plus du coup ton switch ne sert a rien..
il faut que tu déclares ton $p avant ton $_GET pour qu'il renvoie à une page par defaut. car si $_GET['p'] n'existe pas alors ton $p non plus du coup ton switch ne sert a rien..
Salut, j'avais pas vu ce que dit avion-f16, mais c'est pas faux.
Il faut aussi que tu attribue une valeur à $p même si le get n'est pas présent.
Il faut aussi que tu attribue une valeur à $p même si le get n'est pas présent.
if(isset($_GET['p'])){
$p = $_GET['p'];
}
else {
$p = 0;
}
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
je dirais qu'il vaudrait mieux pour toi de mettre une valeur de ton switch car comme dis si $_GET[p] n'existe pas $p vaudra 0 or il n'y a pas de cas ou $p=0 dans ton switch.. attribue la valeur de ta page par defaut