ENVOIE DE FORMULAIRE DES ZERO S'AJOUTE AUX CHAMPS VIDES
dsigner
Messages postés
21
Statut
Membre
-
dsigner Messages postés 21 Statut Membre -
dsigner Messages postés 21 Statut Membre -
Bonjour,
lorsque j'ajoute les notes depuis PHP avec le formulaire les champs vides ont des zeros a la place alors que le problème ne se pose pas lorsque j'insère directement depis la base MySQL
lorsque j'ajoute les notes depuis PHP avec le formulaire les champs vides ont des zeros a la place alors que le problème ne se pose pas lorsque j'insère directement depis la base MySQL
<?php
$host = 'localhost'; // N'oubliez pas de remplir selon vos paramètres
$user = 'root';
$pass = '';
$bdd = 'tsm';
@mysql_connect($host,$user,$pass)
or die("Impossible de se connecter");
@mysql_select_db("$bdd")
or die("Impossible de se connecter");
$resultat2=mysql_query("SELECT * FROM matiere");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>noteAjout</title>
<meta name="keywords" content="" />
<meta name="Adhesive" content="" />
<link href="../../css/admin.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<?php include('../includes/menu.ini.php'); ?>
<div id="page">
<!--boutton deconnection-->
<span class="decnx"> <a href="admin.php?logout=ok">
<font color="white" >Se deconnecter</a></font></span>
<br/><br/> <br/>
<p align="center"><font face="times news roman, tahoma" size="4px" color="white">
<b>AJOUT DE NOTE</b></font>
</p>
<table border="0px" align="center" >
<form method="POST" action="noteInscription.php">
<tr>
<td colspan=6>
<b>Matricule
<input type="text" name="id" id="id" size=7/>
Matiere :</b>
<select name="matiere" id="matiere">
<?php while($matiere=mysql_fetch_array($resultat2)){ ?>
<option value="<?php echo $matiere['matiere']; ?>">
<?php echo ' '.$matiere['matiere']; ?>
</option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td colspan=4 >
<font background="#000" size="4px" color="black" >Trimestre 1</font>
</td>
<td colspan=4>
<font background="#000" size="4px" color="black" >Trimestre 2 </font>
</td>
</tr>
<tr>
<td>
note
<input type="text" name="note1" size=3 maxlength=6 />
</td>
<td>
note2:
<input type="text" name="note2" size="3" maxlength="6" />
</td>
<td>
note3:
<input type="text" name="note3" size="3" maxlength="6" />
</td>
<td>
composition
<input type="text" name="compo1" size="3" maxlength=6 />
</td>
<td>
note4:
<input type="text" name="note4"size="3" maxlength="6" />
</td>
<td>
note5:
<input type="text" name="note5" size="3" maxlength="6" />
</td>
<td>
note6:
<input type="text" name="note6" size="3" maxlength="6" />
</td>
<td>
composition:
<input type="text" name="compo2" size="3" maxlength="6" /></td>
</tr>
<tr>
<td cellpadding=2px colspan=8> <input type="submit" name="ok" value="Ajouter" />
</td>
</tr>
</table> <br /> <br />
</form>
<?php
if(isset($_POST['ok']))
{
$req= mysql_query("select * FROM note where idelevenote='".$_POST['id']."' and matierenote='".$_POST['matiere']."' ");
if(mysql_num_rows($req)>0)
{
echo "MATIERE DEJA AJOUTEE VEILLEZ TOUT SIMPLEMENT CLIQUER SUR MODIFIER ";
}
else
{
$id_eleve=$_POST['id'];
$matiere=$_POST['matiere'];
$note1=$_POST['note1'];
$note2=$_POST['note2'];
$note3=$_POST['note3'];
$compo1=$_POST['compo1'];
$note4=$_POST['note4'];
$note5=$_POST['note5'];
$note6=$_POST['note6'];
$compo2=$_POST['compo2'];
$sql="INSERT INTO note VALUES ('','$id_eleve','$matiere','$note1','$note2', '$note3','$compo1',' ',
'$note4','$note5','$note6','$compo2',' ')";
if($result=mysql_query($sql))
{
echo "note inseree";
}
else
{
echo "l'insersion a échouéé";
}
}//Fin else
}//fin ok
?>
</div>
<div id="footer-wrapper">
<div id="footer">
<p class="copyright">© 2013 TOUS DROIT RESERVE A <a href="#">TOPVISION</a>.</p>
</div>
</div> <!---Fin footer-wratter-->
</div><!--fin wratter-->
</body>
</html>
A voir également:
- ENVOIE DE FORMULAIRE DES ZERO S'AJOUTE AUX CHAMPS VIDES
- Whatsapp formulaire opposition - Guide
- Remettre a zero un pc - Guide
- Formulaire de réclamation facebook compte désactivé - Guide
- Formulaire de reclamation instagram - Guide
- Formulaire de contact le bon coin introuvable - Forum Réseaux sociaux