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
|
<script type="text/javascript">
$(function(){
var error_div = $("erreur_affiche");
error_div.css("background-repeat", "no-repeat");
$("#form_affiche").submit(function(){
error_div.css("margin-left", "45%");
error_div.fadeOut(100);
numero_choisi = $(this).find("input[name=affiche]").val();
$.post("choix_affiche.php",{numero_choisi: affiche},function(data){
if((data == "1") || (data == "2")) {
error_div.css("background-image", "url('images/true.png')");
error_div.css("color", "#00FF55");
error_div.fadeIn().text("Vous avez choisi l'affiche n°." + data + ".");
}
else {
error_div.css("background-image", "url('images/false.png')");
error_div.css("color", "#FF5B5B");
error_div.fadeIn().text("Vous n'avez pas choisi d'affiche.");
}
});
return false;
});
});
</script>
...
<body>
<div id="bloc_affiches" class="article" style="display:none; ">
<h2>Voici une proposition d'affiches pour les concerts de janvier :</h2><br />
<div style="float:left; width:48%;">
<img id="affiche0" src="images/affiches/0Aff_EVMEjanv2019.jpg" width="100%"/>
</div>
<div style="float:right; width:48%;" >
<img id="affiche1" src="images/affiches/1Aff_EVMEjanv2019.jpg" width="100%"/>
</div>
<hr class="no-border" />
<?php
// on se connecte à MySQL
$base = mysql_connect("sql.free.fr", "nom_base", "mdp");
mysql_select_db("nom_base", $base);
// lancement de la requete
$sql = 'SELECT num_affiche FROM te_membre_mbr WHERE login ="'.$_SESSION['login'].'" ';
// on lance la requête (mysql_query) et on impose un message d'erreur si la requête ne se passe pas bien (or die)
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
// on recupere le resultat sous forme d'un tableau
$data = mysql_fetch_array($req);
mysql_free_result ($req);
mysql_close ();
?>
<form action="choix_affiche.php" method="post" id="form_affiche">
<?php if($data['num_affiche'] == "0") {?>
<div style="float:left; margin-left:24%;"><input type= "radio" name="affiche" value="1"/> 1ère affiche</div>
<div style="float:right; margin-right:24%;"><input type= "radio" name="affiche" value="2"/> 2ème affiche</div>
<? } elseif ($data['num_affiche'] == "1") {?>
<div style="float:left; margin-left:24%;"><input type= "radio" name="affiche" value="1" checked="checked"/> 1ère affiche</div>
<div style="float:right; margin-right:24%;"><input type= "radio" name="affiche" value="2"/> 2ème affiche</div>
<? } elseif ($data['num_affiche'] == "2") {?>
<div style="float:left; margin-left:24%;"><input type= "radio" name="affiche" value="1"/> 1ère affiche</div>
<div style="float:right; margin-right:24%;"><input type= "radio" name="affiche" value="2" checked="checked"/> 2ème affiche</div>
<? } ?>
<hr class="no-border" />
<div style="float:center;"><input type="submit" name="Choisir" value="Valider" id="bouton_Choisir"/></div><div id="erreur_affiche" class="error_message"></div>
</form>
<hr class="no-border" />
</div>
... |