Pour me facilité la vie à mon travail j'ai décidais de me pondre quelques pages en PHP+mysql sauf que la derniéres fois que j'ai usé de PHP il fallais encore mettre *.php3 ^^ donc sa date et malheureusement ce n'est pas comme le vélo sa fini par s’oublier XD (et je n'est jamais été un bon codeur)
Mon soucis est simple : j'ai une variable vide et qui devrais pas l’être (ni chêne)...
Exemple de résultat de requéte
Code : Tout sélectionner
INSERT INTO hb (tag,att,resume,inter,tech,service) VALUES ('test102','toto_80','essai 806','tagada','CD','')
Code : Tout sélectionner
<?php
mysql_connect("localhost", "login", "mdp") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
$result = mysql_query("SELECT * FROM service") or die(mysql_error());
?>
<html>
<head>
<title>Formulaire de remplissage</title>
</head>
<body bgcolor=#778899>
<table border=0>
<form name=form1 action=form2sql.php method=post>
<tr>
<td><b>S/N ou Tag</b> :</td>
<td align=center><input type=text name=tag size=16 maxlength=24></td>
<td><input type=checkbox name=graveur value=graveur>Graveur</td>
</tr>
<tr>
<td><b>Attribution</b> :</td>
<td align=center><input type=text name=att size=16 maxlength=24></td>
<td><input type=checkbox name=ipfi value=ipfi>ipfixe</td>
</tr>
<tr>
<td><b>Service</b> :</td>
<td align=center>
<select name=service>
<?php
while($row = mysql_fetch_array( $result )){
echo "<option value=".$row['id'];
echo ">".$row['nom'];
echo "</option>";
}
?>
</select></td>
<td><input type=checkbox name=cajout value=cajout>cleajouter</td>
</tr>
<tr>
<td colspan=2><b>Texte</b> :</td>
</tr>
<tr>
<td colspan=2><textarea name=resume cols=60 rows=2 value=>Résumé</textarea></td>
</tr>
<tr>
<td colspan=2><textarea name=inter cols=60 rows=10 value=>Intervention :</textarea></td>
</tr>
<tr>
<td><b>Technicien</b> :</td>
<td align=center><select name=tech>
<option value=DD>DD</option>
<option value=JG>JG</option>
<option value=CD>CD</option>
<option value=BJ>BJ</option>
<option value=JD>JD</option>
</select></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value=Soumettre></td>
</tr>
</form>
</table>
</body>
</html>
Code : Tout sélectionner
<?php
mysql_connect("localhost", "login", "mdp") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
$tag =$_POST['tag'];
$att =$_POST['att'];
$resume =$_POST['resume'];
$inter =$_POST['inter'];
$tech =$_POST['tech'];
$service =$_post['service']
?>
--
<?php
$req = "INSERT INTO hb (tag,att,resume,inter,tech,service) VALUES ('$tag','$att','$resume','$inter','$tech','$service')";
mysql_query($req) or die(mysql_error());
echo $req;
echo $service;
?>