1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<?php $query = "SELECT `rep_user` FROM `news_dujour_rep` WHERE `rep_user` LIKE '".$_SESSION['login']."';";
include('dbconnect.php'); //connection à la bdd aucun soucis
$a = mysql_num_rows($result);
if($a==0){ ?> //si pas de réponse enregistrer on affiche le form
<div style="width:100%;text-align:center;margin-top:20px;">
<form method="post" action="<?php $rep_contenu = htmlentities($rep_contenu, ENT_QUOTES);
$query = "INSERT INTO `news_dujour_rep` (`rep_date`, `rep_user`, `rep_contenu`) VALUE ( NOW(), '".$_SESSION['login']."', '".$rep_contenu."');";
include('dbconnect.php');
header("location: home.php"); // une fois la réponse poster on rafraichit la page
exit;?>">
<table align="center" style="width:50%;text-align:center;">
<tr><td>Qu'en pensez-vous?</td></tr>
<tr><td><textarea name="rep_contenu" cols="40" rows="6"></textarea></td></tr>
<tr><td><input type="submit" value="Envoyer"></td></tr>
</table>
</form>
</div>
<?php } ?> |