Bonjour,
je voudrai que lorsqu'un utilisateur s'inscrive sur mon site, il puisse choisir un avatar parmi ceux proposés.
J'ai donc pensé à ce code:
<form method="GET" action="inscription.php">
<table>
<tr>
<td><center><label class="labelform1" for="avatar">Avatar: (important: choisir avant de poursuivre le formulaire)</label></center></td>
</tr>
</table>
<table>
<tr>
<!-- AVATAR 1 -->
<?php
if ($_GET['choix'] == 001) {
?>
<td><div class="choix"><a href="inscription.php?choix=001"><img src="../avatar/001.jpg" alt="001" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=001"><img src="../avatar/001.jpg" alt="001" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 2 -->
<?php
if ($_GET['choix'] == 002) {
?>
<td><div class="choix"><a href="inscription.php?choix=002"><img src="../avatar/002.jpg" alt="002" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=002"><img src="../avatar/002.jpg" alt="002" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 3 -->
<?php
if ($_GET['choix'] == 003) {
?>
<td><div class="choix"><a href="inscription.php?choix=003"><img src="../avatar/003.jpg" alt="003" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=003"><img src="../avatar/003.jpg" alt="003" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 4 -->
<?php
if ($_GET['choix'] == 004) {
?>
<td><div class="choix"><a href="inscription.php?choix=004"><img src="../avatar/004.jpg" alt="004" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=004"><img src="../avatar/004.jpg" alt="004" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 5 -->
<?php
if ($_GET['choix'] == 005) {
?>
<td><div class="choix"><a href="inscription.php?choix=005"><img src="../avatar/005.jpg" alt="005" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=005"><img src="../avatar/005.jpg" alt="005" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 6 -->
<?php
if ($_GET['choix'] == 006) {
?>
<td><div class="choix"><a href="inscription.php?choix=006"><img src="../avatar/006.jpg" alt="006" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=006"><img src="../avatar/006.jpg" alt="006" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 7 -->
<?php
if ($_GET['choix'] == 007) {
?>
<td><div class="choix"><a href="inscription.php?choix=007"><img src="../avatar/007.jpg" alt="007" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=007"><img src="../avatar/007.jpg" alt="007" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 8 -->
<?php
if ($_GET['choix'] == 008) {
?>
<td><div class="choix"><a href="inscription.php?choix=008"><img src="../avatar/008.jpg" alt="008" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=008"><img src="../avatar/008.jpg" alt="008" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 9 -->
<?php
if ($_GET['choix'] == 009) {
?>
<td><div class="choix"><a href="inscription.php?choix=009"><img src="../avatar/009.jpg" alt="009" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=009"><img src="../avatar/009.jpg" alt="009" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 10 -->
<?php
if ($_GET['choix'] == 010) {
?>
<td><div class="choix"><a href="inscription.php?choix=010"><img src="../avatar/010.jpg" alt="010" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=010"><img src="../avatar/010.jpg" alt="010" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 11 -->
<?php
if ($_GET['choix'] == 011) {
?>
<td><div class="choix"><a href="inscription.php?choix=011"><img src="../avatar/011.jpg" alt="011" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=011"><img src="../avatar/011.jpg" alt="011" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 12 -->
<?php
if ($_GET['choix'] == 012) {
?>
<td><div class="choix"><a href="inscription.php?choix=012"><img src="../avatar/012.jpg" alt="012" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=012"><img src="../avatar/012.jpg" alt="012" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 13 -->
<?php
if ($_GET['choix'] == 013) {
?>
<td><div class="choix"><a href="inscription.php?choix=013"><img src="../avatar/013.jpg" alt="013" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=013"><img src="../avatar/013.jpg" alt="013" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 14 -->
<?php
if ($_GET['choix'] == 014) {
?>
<td><div class="choix"><a href="inscription.php?choix=014"><img src="../avatar/014.jpg" alt="014" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=014"><img src="../avatar/014.jpg" alt="014" style="width:30px;height:30px;"></a></td>
<?php
}
?>
</tr>
</table>
<table>
<tr>
<!-- AVATAR 15 -->
<?php
if ($_GET['choix'] == 015) {
?>
<td><div class="choix"><a href="inscription.php?choix=015"><img src="../avatar/015.jpg" alt="015" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=015"><img src="../avatar/015.jpg" alt="015" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 16 -->
<?php
if ($_GET['choix'] == 016) {
?>
<td><div class="choix"><a href="inscription.php?choix=016"><img src="../avatar/016.jpg" alt="016" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=016"><img src="../avatar/016.jpg" alt="016" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 17 -->
<?php
if ($_GET['choix'] == 017) {
?>
<td><div class="choix"><a href="inscription.php?choix=017"><img src="../avatar/017.jpg" alt="017" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=017"><img src="../avatar/017.jpg" alt="017" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 18 -->
<?php
if ($_GET['choix'] == 018) {
?>
<td><div class="choix"><a href="inscription.php?choix=018"><img src="../avatar/018.jpg" alt="018" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=018"><img src="../avatar/018.jpg" alt="018" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 19 -->
<?php
if ($_GET['choix'] == 019) {
?>
<td><div class="choix"><a href="inscription.php?choix=019"><img src="../avatar/019.jpg" alt="019" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=019"><img src="../avatar/019.jpg" alt="019" style="width:30px;height:30px;"></a></td>
<?php
}
?>
<!-- AVATAR 20 -->
<?php
if ($_GET['choix'] == 020) {
?>
<td><div class="choix"><a href="inscription.php?choix=020"><img src="../avatar/020.jpg" alt="020" style="width:30px;height:30px;"></a></div></td>
<?php
}
else {
?>
<td><a href="inscription.php?choix=020"><img src="../avatar/020.jpg" alt="020" style="width:30px;height:30px;"></a></td>
<?php
}
?>
</tr>
</table>
</form>
Ce code représente l'affichage sur la page inscription.php, quand l'utlisateur séléctionne un avatar, celui ci devient entouré de blanc (selon mon css) grâce à la variable GET que l'utilisateur vient de définir.
Pour gagner du temps j'ai fais pas mal de copier collé, tous les avatars sont donc censés fonctionner sur le même principe sauf que quand je test le code, il y a des problèmes! :
-Quand je séléctionne l'avatar 001, il devient bordé de blanc (normal) mais le 018 et 019 font de même ?
_Quand je sélectionne l'avatar 008, il ne devient pas bordé de blanc (pas normal) mais le 010 le devient??
Et pas mal d'erreurs de ce genre, après avoir relu maintes et maintes fois mon code, je ne trouve toujours pas l'erreur :/
Si quelqu'un peut m'aider

MERCI
PS: J'ai trouvé une alternative, je la met en place rapidement, si elle marche, le sujet sera résolu!