Aidez moi de corriger ce code

Fermé
ahmed1333 Messages postés 16 Date d'inscription jeudi 28 février 2013 Statut Membre Dernière intervention 15 juin 2014 - Modifié par ahmed1333 le 18/05/2014 à 20:23
ahmed1333 Messages postés 16 Date d'inscription jeudi 28 février 2013 Statut Membre Dernière intervention 15 juin 2014 - 18 mai 2014 à 23:20
dans le formulaire je veut quand je remplie le sujet je veut l'encadrant de se sujet sera remplie automatiquement
voici le code
<tr>
<td><font color="#000000"><strong>encadrant:</strong></font>
<?php
include("connexion.php");
$rq_ts="SELECT encadrant FROM 'sujt' where sujet='$sujet'";
$res_ts=mysql_query($rq_ts) or die ("".mysql_error());

while($res_aff=mysql_fetch_array($res_ts))
{
$encadrant=$res_aff['encadrant'];

?>
<td><input type="text" name="encadrant" value="<?php echo $encadrant; ?>" size="50" /> </td>

<?php
}
?>
</td>
</tr>
A voir également:

2 réponses

Aranud87 Messages postés 18031 Date d'inscription dimanche 29 octobre 2006 Statut Contributeur Dernière intervention 7 juin 2020 3 293
18 mai 2014 à 20:18
Bonjour,

Pour la compréhension de tous, merci de mettre ton code entre (sans espace) :
< code php></ code>
0
ahmed1333 Messages postés 16 Date d'inscription jeudi 28 février 2013 Statut Membre Dernière intervention 15 juin 2014
18 mai 2014 à 23:20
voici le code complais

<html>
<head>
<h2><center><u><b>*--------* Ajouter Planing *--------*</b></u></center></h2><br /><br />
<form name="ajouter_Planing" method="post" action="">
<table align="center" width="60%" >
<tr>
<td><font color="#000000"><strong>sujet:</strong></font></td>
<td>
<select name="sujet" id="sujet" style="width:210px">
<option value="">------</option>
<?php
include("connexion.php");
$rq_ts="SELECT * FROM 'sujt'";
$res_ts=mysql_query($rq_ts) or die ("".mysql_error());
while($res_aff=mysql_fetch_array($res_ts))
{
$sujet=$res_aff['sujet'];
?>
<option value="<?php echo $sujet ?>"><?php echo $sujet ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td><font color="#000000"><strong>encadrant:</strong></font>
<?php
include("connexion.php");
$rq_ts="SELECT encadrant FROM 'sujt' where sujet='$sujet'";
$res_ts=mysql_query($rq_ts) or die ("".mysql_error());
while($res_aff=mysql_fetch_array($res_ts))
{
$encadrant=$res_aff['encadrant'];
?>
<td><input type="text" name="encadrant" value="<?php echo $encadrant; ?>" size="50" /> </td>
<?php
}
?>
</td>
</tr>
<tr>
<td><font color="#000000"><strong>rapporteur:</strong></font></td>
<td><input type="text" name="rapporteur" size="50"/></td>
</tr>
<tr>
<td><font color="#000000"><strong>president:</strong></font></td>
<td><input type="text" name="president" size="50"/></td>
</tr>
<tr>
<td><font color="#000000"><strong>date:</strong></font></td>
<td><input type="date" name="dateS" size="100" style="width:205px"/></td>
</tr>
<tr>
<td><font color="#000000"><strong>horaire:</strong></font></td>
<td><input type="text" name="horaire" size="50"/></td>
</tr>
<tr>
<td><font color="#000000"><strong>salle:</strong></font></td>
<td><select name="salle" style="width:210px">
<option>--------</option>
<option>S1</option>
<option>S2</option>
<option>Info1</option>
<option>Info2</option>
</select></td>
</tr>
</table>
<br />
<center><input type="submit" name="ajouter" value="ajouter" />   
<input type="reset" name="b2" value="annuler" /></center>
</form>
</html>
<?php
if(isset($_POST['ajouter']))
{
$sujet=$_POST['sujet'];
$encadrant=$_POST['encadrant'];
$rapporteur=$_POST['rapporteur'];
$president=$_POST['president'];
$dateS=$_POST['dateS'];
$horaire=$_POST['horaire'];
$salle=$_POST['salle'];
include("connexion.php");
$rq="INSERT INTO 'planing' ('sujet', 'encadrant', 'rapporteur', 'president', 'dateS', 'horaire', 'salle') VALUES ('$sujet', '$encadrant', '$rapporteur', '$president', '$dateS', '$horaire', '$salle')";
$res_rq=mysql_query($rq) or die ("".mysql_error());
if($res_rq==1)
{
echo "<center>Votre ajouter effecteur avec succes</center>";
}
else
{
echo "!ok";
}
}
?>
0