par
Vianney » 02 mars 2005, 12:09
j'ai mis un peu d'ordre en separant les codes et changer un peu. maintenant l'erreur ne s'affiche plus dans la page mais dans l'url quand je valide la recherche !! ://
quand je valide ca donne m'envoie a cet url :
index.php?p=_department_phonebook&department=<br%20/><b>Notice</b>:%20%20Undefined%20index:%20%20dep%20in%20<b>
c:\program%20files\easyphp\www\intranet2.3\page_phone_book.php</b>%20on%20line%20<b>14</b><br%20/>
toujours la meme erreur, ca serait trop beau
/////////////////////////////////////////////////////////////
ma barre de recherche dans le fichier phonebook.php
/////////////////////////////////////////////////////////////
<div class="news">
<h2>search:</h2>
<ul class="contentPF">
<li><form action="index.php?p=_department_phonebook&department=<?php echo $_POST["dep"]?>" method="POST">
Department search:
<SELECT name="dep">
<OPTION VALUE=""></OPTION>
<OPTION VALUE="administration_accounts">Admininistration/Accounts</OPTION>
<OPTION VALUE="GICS">GICS</OPTION>
<OPTION VALUE="IT">IT</OPTION>
<OPTION VALUE="maintenance">Maintenance</OPTION>
<OPTION VALUE="Materials">Materials</OPTION>
<OPTION VALUE="production">Production</OPTION>
<OPTION VALUE="sales_marketing">Sales/Marketing</OPTION>
<OPTION VALUE="service">Service</OPTION>
<OPTION VALUE="R_D">R&D</OPTION>
</SELECT><input type="submit" value="search">
</form></li>
</div>
///////////////////////////////////////////////////////////////////////
///////mon fichier page_department_phonebook.php/////////
///////////////////////////////////////////////////////////////////////
<div class="centre">
<?php
// select default database
mysql_select_db($db_name,$cnx);
//sql query
$department=$_GET['department'];
$sql = "SELECT id,name,firstname,telephone,mobile,department,birthdate,COMMENT FROM people WHERE department ='$department' ORDER BY people.name ASC";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
// on affiche les informations tant que qq1 a afficher
$res = strlen(stripslashes($data['firstname']));
$fl = substr(stripslashes($data['firstname']), -$res, 1); // return the 1st letter of the firstname
echo '<div class="news"><ul class="contentPF"><li><a href="index.php?p=_id_phonebook&id='.$data['id'].'">'.stripslashes(ucfirst($data['name'])).' '.stripslashes(ucfirst($data['firstname'])).'</a></li>';
echo ' <li>Department : <a href="index.php?p=_department_phonebook&department='.stripslashes($data['department']).'">'.stripslashes(ucfirst($data['department'])).'</a></li>';
echo ' <li>Telephone : '.stripslashes($data['telephone']).'</li></ul>';
echo ' <div class="p_pbook"><a href="index.php?p=_id_phonebook&id='.$data['id'].'"><img src="photos/'.$fl.''.stripslashes($data['name']).'.jpg" width="70" height="77" alt="Id"></a></div></div>';
//warning ! print image dynamically depending on the firstname et the name of the person
}
// close mysql
mysql_close();
?>
</div>
////////////////////////////////////////////////////////////////////////////////////////////
je fais un blocage la
jai beau lire des articles jcomprend pas bien la difference entre la methode get d'un formulaire et la fonction $_GET[$var] ://
j'ai mis un peu d'ordre en separant les codes et changer un peu. maintenant l'erreur ne s'affiche plus dans la page mais dans l'url quand je valide la recherche !! ://
quand je valide ca donne m'envoie a cet url :
index.php?p=_department_phonebook&department=<br%20/><b>Notice</b>:%20%20Undefined%20index:%20%20dep%20in%20<b>
c:\program%20files\easyphp\www\intranet2.3\page_phone_book.php</b>%20on%20line%20<b>14</b><br%20/>
toujours la meme erreur, ca serait trop beau
/////////////////////////////////////////////////////////////
ma barre de recherche dans le fichier phonebook.php
/////////////////////////////////////////////////////////////
[php]
<div class="news">
<h2>search:</h2>
<ul class="contentPF">
<li><form action="index.php?p=_department_phonebook&department=<?php echo $_POST["dep"]?>" method="POST">
Department search:
<SELECT name="dep">
<OPTION VALUE=""></OPTION>
<OPTION VALUE="administration_accounts">Admininistration/Accounts</OPTION>
<OPTION VALUE="GICS">GICS</OPTION>
<OPTION VALUE="IT">IT</OPTION>
<OPTION VALUE="maintenance">Maintenance</OPTION>
<OPTION VALUE="Materials">Materials</OPTION>
<OPTION VALUE="production">Production</OPTION>
<OPTION VALUE="sales_marketing">Sales/Marketing</OPTION>
<OPTION VALUE="service">Service</OPTION>
<OPTION VALUE="R_D">R&D</OPTION>
</SELECT><input type="submit" value="search">
</form></li>
</div>
[/php]
///////////////////////////////////////////////////////////////////////
///////mon fichier page_department_phonebook.php/////////
///////////////////////////////////////////////////////////////////////
[php]
<div class="centre">
<?php
// select default database
mysql_select_db($db_name,$cnx);
//sql query
$department=$_GET['department'];
$sql = "SELECT id,name,firstname,telephone,mobile,department,birthdate,COMMENT FROM people WHERE department ='$department' ORDER BY people.name ASC";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
// on affiche les informations tant que qq1 a afficher
$res = strlen(stripslashes($data['firstname']));
$fl = substr(stripslashes($data['firstname']), -$res, 1); // return the 1st letter of the firstname
echo '<div class="news"><ul class="contentPF"><li><a href="index.php?p=_id_phonebook&id='.$data['id'].'">'.stripslashes(ucfirst($data['name'])).' '.stripslashes(ucfirst($data['firstname'])).'</a></li>';
echo ' <li>Department : <a href="index.php?p=_department_phonebook&department='.stripslashes($data['department']).'">'.stripslashes(ucfirst($data['department'])).'</a></li>';
echo ' <li>Telephone : '.stripslashes($data['telephone']).'</li></ul>';
echo ' <div class="p_pbook"><a href="index.php?p=_id_phonebook&id='.$data['id'].'"><img src="photos/'.$fl.''.stripslashes($data['name']).'.jpg" width="70" height="77" alt="Id"></a></div></div>';
//warning ! print image dynamically depending on the firstname et the name of the person
}
// close mysql
mysql_close();
?>
</div>
[/php]
////////////////////////////////////////////////////////////////////////////////////////////
je fais un blocage la :|
jai beau lire des articles jcomprend pas bien la difference entre la methode get d'un formulaire et la fonction $_GET[$var] ://