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
| <?php
session_start();
$_SESSION['devis_text'] = $_POST['devis_text'];
include('include/config.php');
$db = mysql_connect(DBHOST, DBUSER, DBPASS);
mysql_select_db(DBNAME,$db);
$sql = 'SELECT Afficher_devis_oui_ou_non FROM tb_Options';
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
$toto = $data['Afficher_devis_oui_ou_non'];
}
mysql_close();
echo 'Voila le resultat '.'<b>'.$toto.'</b>';
?>
<body onload="select_it()">
<?
if (isset($_POST['devis_text']))
{
session_start();
$db = mysql_connect(DBHOST, DBUSER, DBPASS);
mysql_select_db(DBNAME,$db);
$sql = "UPDATE tb_Options SET Afficher_devis_oui_ou_non='$devis_text'";
mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
// // // // // //
$sql = 'SELECT Afficher_devis_oui_ou_non FROM tb_Options';
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
$toto = $data['Afficher_devis_oui_ou_non'];
}
mysql_close();
}
?>
<form name="frm2" method="post" action="<?=$_SERVER['PHP_POST']?>">
<table border="1" width="100%" align="center" style="margin:1; padding:1; border-width:1; border-color:rgb(102,204,204); border-style:solid;" cellspacing="0" bordercolor="#66CCCC" bordercolordark="#66CC99" bordercolorlight="#66CCFF">
<tr>
<td >
Voulez-vous afficher les devis pour les clients ?
</td>
<td width="100">
<input type="radio" name="Ratio_affiche_devis_oui" id="Ratio_affiche_devis_oui" value="Oui" class="clean" onclick="changement(0);" >Oui
<input type="radio" name="Ratio_affiche_devis_non" id="Ratio_affiche_devis_non" value="Non" class="clean" onclick="changement(1);" >Non
<br><input type="text" name="devis_text" id="devis_text" size="10" value="<?=$toto?>">
</td>
</tr>
</table>
<input type="submit" name="envoi" value="Envoyer">
<script type="text/javascript">
function select_it()
{
if(document.forms["frm2"].elements['devis_text'].value = 'oui')
{
document.getElementById('Ratio_affiche_devis_oui').checked=true;
document.getElementById('Ratio_affiche_devis_non').checked=false;
}
else
{
document.getElementById('Ratio_affiche_devis_non').checked=true;
document.getElementById('Ratio_affiche_devis_oui').checked=false;
}
}
function changement(lequel)
{ switch (lequel) {
case 0:
frm2.devis_text.value='oui';
document.getElementById('Ratio_affiche_devis_non').checked=false;
break;
case 1:
frm2.devis_text.value='non';
document.getElementById('Ratio_affiche_devis_oui').checked=false;
break;
} }
</script>
</form> |