Aidez moi de corriger ce code
ahmed1333
Messages postés
16
Date d'inscription
Statut
Membre
Dernière intervention
-
ahmed1333 Messages postés 16 Date d'inscription Statut Membre Dernière intervention -
ahmed1333 Messages postés 16 Date d'inscription Statut Membre Dernière intervention -
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>
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:
- Aidez moi de corriger ce code
- Code ascii - Guide
- Code de déverrouillage oublié - Guide
- Code puk bloqué - Guide
- Code activation windows 10 - Guide
- Code blocks - Télécharger - Langages
2 réponses
Bonjour,
Pour la compréhension de tous, merci de mettre ton code entre (sans espace) :
< code php></ code>
Pour la compréhension de tous, merci de mettre ton code entre (sans espace) :
< code php></ code>
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";
}
}
?>
<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";
}
}
?>