[PHP-JS] Réalisation de fonction
Voila, je voudrais faire une fonction mais je ne sais pa comment m'y prendre.
Je voudrais qu'une fois le formulaire fini par l'utilisateur, que tous les boutons soit coché, ou sinon si ils sont pas tous coché de mettre une alert (ou autre chose).
Dans mon code php j'utilise deux boucles 'while', et avant ce code php j'ai quelque input en html.
Ceux en html sont deja controler avec le bouton submit.
Voici mon code php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
<form action="Add.php" method="post" name="monform" onsubmit="return donneavis()">
........
<input en html>
........
<?php
include("../Connections/connec.php");
mysql_select_db('satisfaction') or die('Erreur de selection '.mysql_error());
$query1 = "SELECT COUNT(nom_appli) FROM appli";
$query2 = "SELECT COUNT(nom_appli_fr) FROM appli_fr";
$result1 = mysql_query($query1) or die(mysql_error());
$result2 = mysql_query($query2) or die(mysql_error());
$result = mysql_query("SELECT nom_appli FROM appli");
while ($row = mysql_fetch_array($result))
{
echo "Pour l'application <b>";
echo $row["nom_appli"];
echo "</b> vous êtes :<br><br>";
echo "<table width=\"600\">
<tr>
<td align=\"center\">";
echo "
<button style=\"cursor:hand; background:crimson; color:white; border:solid 1px black;\" type=\"button\" disabled >Très insatisfait</button>
</td>";
echo "<td align=\"center\">
<button style=\"cursor:hand; background:firebrick; color:white; border:solid 1px black;\" type=\"button\" disabled >Insatisfait</button>
</td>";
echo "<td align=\"center\">
<button style=\"cursor:hand; background:tan; color:white; border:solid 1px black;\" type=\"button\" disabled >Moyen</button>
</td>";
echo "<td align=\"center\">
<button style=\"cursor:hand; background:greenyellow; color:white; border:solid 1px black;\" type=\"button\" disabled >Bien</button>
</td>";
echo "<td align=\"center\">
<button style=\"cursor:hand; background:forestgreen; color:white; border:solid 1px black;\" type=\"button\" disabled >Exellent</button>
</td>";
echo "<td align=\"center\">
<button style=\"cursor:hand; background:grey; color:white; border:solid 1px black;\" type=\"button\" disabled >Non utilisé</button>";
echo "</td>
</tr>
<tr>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"1\" name=\"";
echo $row["nom_appli"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"2\" name=\"";
echo $row["nom_appli"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"3\" name=\"";
echo $row["nom_appli"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"4\" name=\"";
echo $row["nom_appli"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"5\" name=\"";
echo $row["nom_appli"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"NULL\" name=\"";
echo $row["nom_appli"];
echo "\"></td>";
echo "</tr>
</table>
<br>";
}
$result3 = mysql_query("SELECT nom_appli_fr FROM appli_fr");
while ($row = mysql_fetch_array($result3))
{
echo "Pour l'application <b>";
echo $row["nom_appli_fr"];
echo "</b> vous êtes :<br><br>";
echo "<table width=\"600\">
<tr>
<td align=\"center\">";
echo "
<button style=\"cursor:hand; background:crimson; color:white; border:solid 1px black;\" type=\"button\" disabled >Très insatisfait</button>
</td>";
$i++;
echo "<td align=\"center\">
<button style=\"cursor:hand; background:firebrick; color:white; border:solid 1px black;\" type=\"button\" disabled >Insatisfait</button>
</td>";
$i++;
echo "<td align=\"center\">
<button style=\"cursor:hand; background:tan; color:white; border:solid 1px black;\" type=\"button\" disabled >Moyen</button>
</td>";
$i++;
echo "<td align=\"center\">
<button style=\"cursor:hand; background:greenyellow; color:white; border:solid 1px black;\" type=\"button\" disabled >Bien</button>
</td>";
$i++;
echo "<td align=\"center\">
<button style=\"cursor:hand; background:forestgreen; color:white; border:solid 1px black;\" type=\"button\" disabled >Exellent</button>
</td>";
$i++;
echo "<td align=\"center\">
<button style=\"cursor:hand; background:grey; color:white; border:solid 1px black;\" type=\"button\" disabled >Non utilisé</button>";
$i++;
echo "</td>
</tr>
<tr>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"1\" name=\"";
echo $row["nom_appli_fr"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"2\" name=\"";
echo $row["nom_appli_fr"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"3\" name=\"";
echo $row["nom_appli_fr"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"4\" name=\"";
echo $row["nom_appli_fr"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"5\" name=\"";
echo $row["nom_appli_fr"];
echo "\"></td>";
echo "<td align=\"center\">
<input type=\"radio\" value=\"NULL\" name=\"";
echo $row["nom_appli_fr"];
echo "\"></td>";
echo "</tr>
</table>
<br>";
}
mysql_close();
?>
</br>
<input type="submit" value="Envoyer" style="cursor:hand; background:navy; color:white; border:solid 1px black;">
<input type="reset" value="Recommencer" style="cursor:hand; background:navy; color:white; border:solid 1px black;">
</form> |
J'ai essayé de mettre du php dans la fonction javascript mais bon ca marche pas puiske javascript (coté client) et php(coté serveur), enfin il me semble puiske ca marche pas :aie:
J'attend vos reponses. Merci d'avance