PHP

Résolu/Fermé
Mayssa28 Messages postés 13 Date d'inscription samedi 14 mai 2011 Statut Membre Dernière intervention 18 mai 2011 - 14 mai 2011 à 18:15
canarder Messages postés 1714 Date d'inscription jeudi 28 août 2008 Statut Membre Dernière intervention 13 mai 2018 - 14 mai 2011 à 21:17
Bonjour,
je suis debutante en php et je n'arrive pas à recuperer les valeur des champs dans le formulaire en utilisant $_post.
voila mon code
<html>
<head>
<a href="MenuPrincipal.html">Menu Principal</a><title></title></head>
<body>

<?
echo "<br> la liste des article <br>" ;
$con=mysql_connect("127.0.0.1","root","")or die (mysql_error());
mysql_select_db("base_stock")or die (mysql_error());
$r=mysql_query("select * from articles where prix >".$_GET['prixmin'] )or die (mysql_error());
/*pbleme recupere valeur champ*/


echo " <table border='1'><tr><td>id_art</td><td>Designation</td><td>Description</td><td>prix</td><td>dispo</td></tr>" ;
while($l=mysql_fetch_array($r)) {
echo"<tr bgcolor='pink'>";
echo "<td>$l[0]</td><td>$l[1]</td><td>$l[2]</td><td>$l[3]</td><td>$l[4]</td></tr>";
}
echo "</table>";
mysql_close($con);

?>


<form name="f1" method="GET" action="recherche.php">
<table border = 1>
<tr>
<td>nom article<input type="text" name="id" ></td><td><a href="actualise_art.php">actualiser </a></td>
</tr>
<tr>
<td> prix </td>
<td>prixmin<input type="text" name="prixmin" > prixmax<input type="text" name="prixmax" ></td>

</tr>
<tr>
<td><select name="sel">
<?php
$con=mysql_connect("127.0.0.1","root","")or die (mysql_error());
mysql_select_db("base_stock")or die (mysql_error());
$r=mysql_query("select * from categorie")or die (mysql_error());
while($l=mysql_fetch_array($r)) {
echo "<option value=".$l['id_cat'].">".$l['nom_cat'];
}?></select></td><td><input type="submit" value="rechercher">
</td></tr>
</table>
</form>
</body>
</html>

MERCI

A voir également:

3 réponses

loveparade Messages postés 506 Date d'inscription mercredi 20 février 2008 Statut Membre Dernière intervention 14 mai 2011 60
14 mai 2011 à 18:47
Remplaces tous les GET par POST et voila c'est pas plus complique que ca.

------------------------------------------------------
join us now and share the software
you'll be free hackers you'll be free
...
0
Mayssa28 Messages postés 13 Date d'inscription samedi 14 mai 2011 Statut Membre Dernière intervention 18 mai 2011
14 mai 2011 à 19:41
ca marche :D jte remercie pr ta reponse
0
canarder Messages postés 1714 Date d'inscription jeudi 28 août 2008 Statut Membre Dernière intervention 13 mai 2018 354
14 mai 2011 à 21:17
met résolu

garde à l'esprit que :
$_GET contient tes variable get (index.php?var=val ou formulaire avec method="get")
$_POST contient tes variables post (avec formulaire en method="post")

(il y en a d'autres mais inutiles de les apprendre maintenant)
0