note 111246 added to mysql.examples

From: Date: Wed, 30 Jan 2013 11:23:01 +0000
Subject: note 111246 added to mysql.examples
Groups: php.notes 
Request: Send a blank email to php-notes+get-193440@lists.php.net to get a copy of this message
<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> ---- Server IP: 69.147.83.199 Probable Submitter: 212.178.222.224 ---- Manual Page -- http://php.net/manual/en/mysql.examples.php Edit -- https://master.php.net/note/edit/111246 Del: integrated -- https://master.php.net/note/delete/111246/integrated Del: useless -- https://master.php.net/note/delete/111246/useless Del: bad code -- https://master.php.net/note/delete/111246/bad+code Del: spam -- https://master.php.net/note/delete/111246/spam Del: non-english -- https://master.php.net/note/delete/111246/non-english Del: in docs -- https://master.php.net/note/delete/111246/in+docs Del: other reasons-- https://master.php.net/note/delete/111246 Reject -- https://master.php.net/note/reject/111246 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#193440) next »