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
| <html>
<body>
<?php
$db_host = "127.0.0.1";
$db_user = "root";
$db_name = "USERS";
$db_pass = "";
function connection(){
global $db_host,$db_user,$db_name,$db_pass;
$connectId = mysql_connect($db_host,$db_user,$db_pass)or die(mysql_error());
mysql_select_db("$db_name",$connectId)or die(mysql_error());
if(!$connectId){
return -1;
}
else if(!mysql_select_db($db_name))
{
return -1;
}
else
{
return $connectId;
}
function disconnect($connectId){
return mysql_close($connectId);
}
}
session_start();
$con = connection();
if(!empty($_POST['txtName'])){
$sql = "INSERT INTO invites(nom, prenom, gender, menu, P_id, Allergie)
values('".$_POST['txtName'] ."','".$_POST['txtFname']."','".$_POST['radGenre']."','".$_POST['cboMenu']."', ".$_SESSION['PID']."
,'".$_POST['txtAllergie'].")";
$result = mysql_query($sql);
if($result == true){
$_SESSION['compt']+=1;
$_SESSION['food_id']=2;
echo $_SESSION['food_id'];
}
mysql_close();
$invites = $_SESSION['nbInvites']+1;
if($_SESSION['compt']== $invites)
{
session_destroy();
header("Location: Accueil.htm");
}
}
else{$_SESSION['compt']=0;}
/*******************************/
$invites = $_SESSION['nbInvites']+1 ;
if(isset($_POST['txtFname'])){$test=$_SESSION['food_id'];}else{$test=0;}
//echo $test."-".$_SESSION['compt']."/".$invites."-";
if($test == 0){
echo "3) S'il vous plait, veuillez remplir les informations ci-dessous: ";
}
else{
echo "3) S'il vous plait, veuillez remplir les informations pour vos invités: ";
}
echo "<form name='frmInvitation' id='frmInvitation' caption='Question3.php' method='post'>";
//for($i=0; $i<$inviter; $i++){
echo "<table border='0'>";
echo "<tr>";
echo "<td>Nom : </td>";
echo "<td>     <input name='txtName' type='text' /></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Prenom : </td>";
echo "<td>     <input name='txtFname' type='text' /></td>";
echo "</tr>";
echo "<tr>";
echo "<td><input name='radGenre' type='radio' value='Adulte' checked='true'/>Adulte</td>";
echo "<td>     <input name='radGenre' type='radio' value='Enfant' />Enfant
</td>";
echo "</tr>";
echo "<tr>";
echo "<td><br/></td>";
echo "</tr>";
echo "</table>";
echo "<table>";
echo "<tr>";
echo "<td colspan='2'><p> Choix du menu : </p></td>";
echo "</tr>";
echo "<tr>";
echo "<td><select name='cboMenu'>";
echo "<option value='Filet de porc aux canneberges du rang St-Albert'>
Filet de porc aux canneberges du rang St-Albert</option>";
echo "<option value='Poulet farci au prosciutto, sauce crême, vinaigre de vin blanc et sauge'>
Poulet farci au prosciutto, sauce crême, vinaigre de vin blanc et sauge</option>";
echo "<option value='Tournedos de saumon de Nouvelle-ecosse, salsa de fenouil au citron et aux herbes'>
Tournedos de saumon de Nouvelle-ecosse, salsa de fenouil au citron et aux herbes</option>";
echo "<option value='Menu enfant'>Menu enfant</option>";
echo "</td>";
echo "<td></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2'> Êtes-vous allergique à certains aliments? Si oui, veuillez l'indiquer. </td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2'> <input name='txtAllergie' type='text' value='Aucune'> </td>";
echo "</tr>";
// enregistrer l'inviter d'abord.
echo "<td><input name='btnAjouter' type='submit' value='Ajouter' />";
echo "     ";
echo "<input name='btnTerminer' type='button' value='Terminer'/></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
echo "</br></br>";
//}
?>
</body>
</html> |
Partager