Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $jmeno = "";
- $prijmeni = "";
- $bydliste = "";
- $kusy = 0;
- $sent = false;
- if($_POST)
- {
- if(isSet($_POST["jmeno"]) && $_POST["jmeno"] !="" && isSet($_POST["prijmeni"]) && $_POST["prijmeni"] !="" && isSet($_POST["bydliste"]) && $_POST["bydliste"] !="" && isSet($_POST["kusy"]) && $_POST["kusy"] !="")
- {
- $sent = true;
- }
- else
- {
- return;
- }
- }
- if ($sent == true)
- {
- $jmeno = $_POST["jmeno"];
- $prijmeni = $_POST["prijmeni"];
- $bydliste = $_POST["bydliste"];
- $kusy = (int)$_POST["kusy"];
- }
- ?>
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <style>
- @import url(http://fonts.googleapis.com/css?family=Roboto:100,300&subset=latin,latin-ext);
- *
- {
- font-family: 'Roboto', sans-serif;
- font-size:18px;
- margin:0;
- padding:0;
- }
- body
- {
- background-color:rgb(211, 210, 184);
- }
- #pi
- {
- margin:0 auto;
- width:400px;
- height:400px;
- background-color:rgba(0,0,0,0.1);
- padding-top:60px;
- margin-top:20px;
- }
- label
- {
- margin-left:86px;
- display:block;
- }
- input
- {
- display:block;
- margin:0 auto;
- }
- #ffff
- {
- display:block;
- margin:0 auto;
- width:100px;
- height:50px;
- margin-top:15px;
- }
- #nv
- {
- margin:0 auto;
- width:400px;
- height:100px;
- margin-top:40px;
- background-color:rgba(0, 0, 0,0.4);
- line-height:100px;
- font-size:35px;
- padding-left:50px;
- }
- #bb
- {
- width:100%;
- height:35px;
- bottom:0;
- left:0;
- position:absolute;
- text-align:center;
- color:white;
- line-height:35px;
- background-color:black;
- position:fixed;
- }
- #kn
- {
- width:400px;
- height:50px;
- margin:0 auto;
- margin-top: 20px;
- background-color:rgba(0, 0, 0,0.4);
- line-height:50px;
- text-align:center;
- }
- </style>
- </head>
- <body>
- <div id="nv">
- &&_FORM
- </div>
- <div id="pi">
- <form id="form" method="post">
- <label>Jméno:</label>
- <input type="text" name="jmeno"><br>
- <label>Příjmení:</label>
- <input type="text" name="prijmeni"><br>
- <label>Bydliště:</label>
- <input type="text" name="bydliste"><br>
- <label>Počet kusů:</label>
- <input type="number" name="kusy" value="0"><br>
- <input type="submit" name="Odeslat" value="Odeslat" id="ffff">
- </form>
- </div>
- <div id="bb">
- Ondřej Soukup
- </div>
- <?php
- $dbArray = parse_ini_file("spso.mysql.ini");
- $cnctString = mysql_connect('websql.in.spsostrov.cz', $dbArray['username'], $dbArray['password']);
- mysql_select_db($dbArray['database']);
- mysql_query("SET CHARACTER SET utf8");
- $sql = "INSERT INTO objednavky01 (jmeno, prijmeni, bydliste, kusy)
- VALUES ('$jmeno', '$prijmeni', '$bydliste', $kusy)";
- $result = mysql_query($sql);
- echo "<div id='kn'>";
- if ($result === TRUE)
- {
- echo "Vše v pořádku.";
- } else
- {
- $hlas = "Chybí údaje!";
- echo "$hlas";
- }
- mysql_close($cnctString);
- echo "</div>";
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement