J ai fait ce qui tu m a dit j ai efacee l espace mais le probleme reste le meme l insertion a la base de donne
les donne n envoit pas a la base donnee je ne sais pas ou le probleme voia mon stp detecte aide moi pour trouver le probleme voila mon code ( la selection a la base de donne ca marche mais l insertion non )
<?php
$i=1;
$var=mysql_connect("localhost","root","");
mysql_select_db("test");
$sql="select question from examen1";
$result=mysql_query($sql);
WHILE ($tab = mysql_fetch_array($result) )
{?>
<h4>
<?php
echo "$i) question N°$i:<br> $tab[question] <br>";
$i++;
}
?>
</h4>
<?php
if (isset($_POST['reponse1']) and isset($_POST['reponse2'])and isset($_POST['reponse3']) and isset($_POST['reponse4']) and isset($_POST['reponse5']))
{$reponse1=$_POST['reponse1'];
$reponse2=$_POST['reponse2'];
$reponse3=$_POST['reponse3'];
$reponse4=$_POST['reponse4'];
$reponse5=$_POST['reponse5'];
$var=mysql_connect("localhost","root","");
mysql_select_db("test",$var);
$req="INSERT INTO tab_reponse ('reponse_quest')".
"VALUES ('".$reponse1."')";
$result = mysql_query($req);
}
?>
<form method=post action="quest_select.php">
<SELECT name="reponse1" id="reponse1">
<?php
$var=mysql_connect("localhost","root","");
mysql_select_db("test",$var);
$sql="select choix1,choix2,choix3 from examen1 where name='1'";
$result=mysql_query($sql);
WHILE ($tab = mysql_fetch_array($result))
{?>
<OPTION><?php echo "$tab[0] " ; ?> </option>
<OPTION><?php echo "$tab[1] " ; ?> </option>
<OPTION><?php echo "$tab[2] " ; ?> </option>
<?php
}
?>
</SELECT>
<?php
mysql_close();
?>
</form>
<form method="post" action="quest_select.php">
<SELECT name="reponse2" id="reponse2">
<?php
$var=mysql_connect("localhost","root","");
mysql_select_db("test",$var);
$sql="select choix1,choix2,choix3 from examen1 where name='2'";
$result=mysql_query($sql);
WHILE ($tab = mysql_fetch_array($result))
{?>
<OPTION><?php echo "$tab[0] "; ?> </option>
<OPTION><?php echo "$tab[1] "; ?> </option>
<OPTION><?php echo "$tab[2] "; ?> </option>
<?php
}
?>
</SELECT>
<?php
mysql_close();
?>
</form>
<form method="get" action="quest_select.php">
<SELECT name="reponse3" id="reponse3">
<?php
$var=mysql_connect("localhost","root","");
mysql_select_db("test",$var);
$sql="select choix1,choix2,choix3 from examen1 where name='3'";
$result=mysql_query($sql);
WHILE ($tab = mysql_fetch_array($result))
{?>
<OPTION><?php echo "$tab[0] "; ?> </option>
<OPTION><?php echo "$tab[1] "; ?> </option>
<OPTION><?php echo "$tab[2] "; ?> </option>
<?php
}
?>
</SELECT>
<?php
mysql_close();
?>
</form>
<form method="post" action="quest_select.php">
<SELECT name="reponse4" id="reponse4">
<?php
$var=mysql_connect("localhost","root","");
mysql_select_db("test",$var);
$sql="select choix1,choix2,choix3 from examen1 where name='4'";
$result=mysql_query($sql);
WHILE ($tab = mysql_fetch_array($result))
{?>
<OPTION><?php echo "$tab[0] "; ?> </option>
<OPTION><?php echo "$tab[1] "; ?> </option>
<OPTION><?php echo "$tab[2] "; ?> </option>
<?php
}
?>
</SELECT>
<?php
mysql_close();
?>
</form>
<form method="post" action="quest_select.php">
<SELECT name="reponse5" id="reponse5">
<?php
$var=mysql_connect("localhost","root","");
mysql_select_db("test",$var);
$sql="select choix1,choix2,choix3 from examen1 where name='5'";
$result=mysql_query($sql);
WHILE ($tab = mysql_fetch_array($result))
{?>
<OPTION><?php echo "$tab[0] "; ?> </option>
<OPTION><?php echo "$tab[1] "; ?> </option>
<OPTION><?php echo "$tab[2] "; ?> </option>
<?php
}
?>
</SELECT>
<?php
mysql_close();
?>
</form>
merci pour vos aide