Version complète : Lien PHP pour choisir qualité playeur.
Forum Fr > Informatique > Internet > Création de Sites Web
Mac-Gayver
Bonjours,

Je suis actuellement en train de créer une page pour un lecteur de flux audio.
Celle-ci est en PHP.

Le problème est dans le codage, la page affiche :
"Notice: Undefined index: channels in F:\Serveur\HTTP\Webradio\NEW\pc\playeur\qualite\01-channels.php on line 9"

Voici le codage :
-"01-channels.php"
Code
<title> MasterRadio - Playeur </title>
<center>
<form>
<input type=button value="Mono" onclick="window.open('Mono','01-channels.php?c=1','toolbar=0,menubar=0,location=0,scrollbars=0,width=520,height=332,resizable=0
,directories=0')"></a>
<input type=button value="Stéréo" onclick="window.open('Stéréo','01-channels.php?c=2','toolbar=0,menubar=0,location=0,scrollbars=0,width=520,height=332,resizable=0
,directories=0')"></a>
</form>
</center>
<?php
$c = $_GET['channels'];
if ($c== '1') {
include('02-bitrate.php?c=1');
}
elseif ($c== '2') {
include('02-bitrate.php?c=2');
}
?>


-"02-bitrate.php"
Code
<title> MasterRadio - Playeur </title>
<center>
<form>
<input type=button value="32 BIT" onclick="window.open('32 BIT','02-bitrate.php?c=1&b=32','toolbar=0,menubar=0,location=0,scrollbars=0,width=520,height=332,resizable=0
,directories=0')"></a>
<input type=button value="64 BIT" onclick="window.open('64 BIT','02-bitrate.php?c=2&b=64','toolbar=0,menubar=0,location=0,scrollbars=0,width=520,height=332,resizable=0
,directories=0')"></a>
</form>
</center>
<?php
$c = $_GET['channels'];
$b = $_GET['bitrate'];
if ($c== '1' && $b== '32') {
include('03-samplerate.php?c=1&b=32');
}
elseif ($c== '2' && $b== '64') {
include('03-samplerate.php?c=2&b=64');
}
?>


-"03-samplerate.php"
Code
<title> MasterRadio - Playeur </title>
<center>
<form>
<input type=button value="22050 Mhz" onclick="window.open('22050 Mhz','03-samplerate.php?c=1&b=32&s=22050','toolbar=0,menubar=0,location=0,scrollbars=0,width=520,height=332,resizable=0
,directories=0')"></a>
<input type=button value="44100 Mhz" onclick="window.open('44100 Mhz','03-samplerate.php?c=2&b=64&s=44100','toolbar=0,menubar=0,location=0,scrollbars=0,width=520,height=332,resizable=0
,directories=0')"></a>
</form>
</center>
<?php
$c = $_GET['channels'];
$b = $_GET['bitrate'];
$s = $_GET['samplerate'];
if ($c== '1' && $b== '32' && $s== '22050') {
include('../playeurs.php?c=1&b=32&s=22050');
}
elseif ($c== '2' && $b== '64' && $s== '44100') {
include('../playeurs.php?c=2&b=64&s=44100');
}
?>


Voilà je ne comprend pas mon erreur...

Merci beaucoup pour votre aide !
A+
Craspine69
Tu as testé ce code sur un ftp locale ou hebergé sur un serveur web ?
Ryo
Salut,

Hum à mon avis, c'est dû à l'utilisation de mauvaises variables GET.

Ton fichier 01-channels.php inclus le fichier 02-bitrate.php?c=1
ta variable passée en argument est donc c et a la valeur 1

Or dans 02-bitrate.php, tu lui demandes ça : $c = $_GET['channels'];
Tu lui dis : "la variable c prend pour valeur l'argument passé dans l'url qui s'appelle channels

d'où l'erreur : Undefined index: channels -> "l'argument channels n'est pas défini"

Soit tu mets : $c = $_GET['channels'];
et dans ce cas tu dois mettre -> include('02-bitrate.php?channels=1');

Soit tu mets : $c = $_GET['c'];
et dans ce cas tu laisses -> include('02-bitrate.php?c=1');
Mac-Gayver
Salut
Ah oui voilà je vien de comprendre comment ça fonctionné biggrin.gif
Merci beaucoup pour vos aides je vais pouvoir enfin avancé dans ce script cool.gif
Bonne nuit et encore merci thumbsup.gif
A+

Citation (Craspine69 @ samedi 12 juillet 2008 à 20:47) *
Tu as testé ce code sur un ftp locale ou hebergé sur un serveur web ?



Oui, mais le problème était bien dans "channels", merci beaucoup pour ton aide.
Bonne nuit A+
Invision Power Board © 2001-2009 Invision Power Services, Inc.