note 111246 deleted from mysql.examples by philip

From: Date: Wed, 30 Jan 2013 23:58:57 +0000
Subject: note 111246 deleted from mysql.examples by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-193456@lists.php.net to get a copy of this message
Note Submitter: henk ---- <html> <head> <title>Gasten toevoegen aan de database</title> </head> <body> <?php $naam = ""; if (!empty($_POST["Klantid"])) { $Klantid = $_POST["Klantid"]; } else { $Klantid = ""; } if (!empty($_POST["Kamer"])) { $Kamer = $_POST["Kamer"]; } else { $Kamer = ""; } if (!empty($_POST["Aantalovernachtingen"])) { $Aantalovernachtingen = $_POST["Aantalovernachtingen"]; } else { $Aantalovernachtingen = ""; } if (!empty($_POST["Aantalontbijten"])) { $Aantalontbijten = $_POST["Aantalontbijten"]; } else { $Aantalontbijten = ""; } if (!empty($_POST["Aantallunches"])) { $Aantallunches = $_POST["Aantallunches"]; } else { $Aantallunches = ""; } if (!empty($_POST["Aantaldiners"])) { $Aantaldiners = $_POST["Aantaldiners"]; } else { $Aantaldiners = ""; } ?> <form name="toevoegen" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post"> <fieldset style="width:380px;background-color:#fedcba;"> <p align="center"><b>Vul onderstaande gegevens in en registreer</b></p> <fieldset style="width:340px;background-color:#abcdef;" align="center"> <table> <tr> <td>Klantid:</td> <td align="right">*<input required="required" type="text" name="Klantid" size="25"></p><p></p></td> </tr> <tr> <td>Type kamer:</td> <td align="right"> Eenpersoons <input type="radio" value="Eenpersoons" name="Kamer">à €50</p><p></p></td><tr> <td></td> <td align="right"> Tweepersoons <input type="radio" value="Tweepersoons" checked name="Kamer">à €75 </p><p></p></td> </tr> </tr> <tr> <td>Aantal overnachtingen:</td> <td align="right">*<input required="required" type="text" name="Aantalovernachtingen" size="25"></p><p></p></td> </tr> <tr> <td>Aantal ontbijten:</td> <td align="right">*<input required="required" type="number" name="Aantalontbijten" size="25"></p><p></p></td> </tr> <tr> <td>Aantal lunches:</td> <td align="right">*<input required="required" type="text" name="Aantallunches" size="25"></p><p></p></td> </tr> <tr> <td>Aantal diners:</td> <td align="right">*<input required="required" type="email" name="Aantaldiners" size="25"></p><p></p></td> </tr> <tr> <td><input type="submit" value="Registreer"> <td align="right"><?php echo "<strong>" . date ("d - m - Y") . "</strong>";?></p></td> </tr> </table> </fieldset> <div align="center"><strong> <?php if ($_POST) { if (empty($Klantid)) { echo "Klantid niet ingevuld!"; } else if (empty($Aantalovernachtingen)) { echo "Aantal overnachtingen niet ingevuld!"; } else if (empty($Aantalontbijten)) { echo "Aantal ontbijten adres niet ingevuld!"; } else if (empty($Aantallunches)) { echo "Aantal lunches niet ingevuld!"; } else if (empty($Aantaldiners)) { echo "Aantal diners niet ingevuld!"; } else { mysql_connect("raayland.net","pascalschepman","9hU65u"); mysql_select_db("Enigma09_"); $query = "SELECT * FROM Gasten WHERE id = '$Klantid'"; $resultaat = mysql_query($query); while ($row = mysql_fetch_array($resultaat)) { $naam = $row["id"]; } if (empty($naam)) { echo "U bent niet bij ons bekent"; } else { $query = "INSERT INTO Reserveringen (Klantid, Kamer, Aantalovernachtingen, Aantalontbijten, Aantallunches, Aantaldiners) VALUES ('$Klantid', '$Kamer', '$Aantalovernachtingen', '$Aantalontbijten', '$Aantallunches', '$Aantaldiners')"; mysql_query($query) or die(mysql_error()); echo "Gereserveerd!"; } } } ?> </strong></div> <p></p> </fieldset> </form> </body> </html>

« previous php.notes (#193456) next »