Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $dbname = "erlent_av31";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- if(isset($_POST['SubmitButton'])){
- ////////// andmed
- $EesNimi=$_POST['eesnimi'];
- $PereNimi=$_POST['perenimi'];
- $IsikuKood=$_POST['isikukood'];
- $Kursus=$_POST['kursus'];
- $sql = "INSERT INTO andmed (EesNimi, PereNimi, IsikuKood, Kursus)
- VALUES ('$EesNimi', '$PereNimi', '$IsikuKood', '$Kursus')";
- if ($conn->query($sql) === TRUE) {
- echo " ";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- ////////// info
- $hinne=$_POST['hinne']; //tootenimi
- $selgitus=$_POST['selgitus']; //tootekaal
- $sql = "INSERT INTO info (hinne, selgitus)
- VALUES ('$hinne', '$selgitus')";
- if ($conn->query($sql) === TRUE) {
- echo " ";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- ////////// uhenduse värk
- $last = $conn->insert_id;
- $sql = "INSERT INTO `uhendus`(andmed_id,info_id)
- VALUES ('$last', '$last')";
- if ($conn->query($sql) === TRUE) {
- echo " ";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- }
- ?>
- <head>
- </head>
- <style>
- /* Full-width input fields */
- input[type=text], input[type=password], input[type=number] {
- width: 100%;
- padding: 12px 20px;
- margin: 8px 0;
- display: inline-block;
- border: 1px solid #ccc;
- box-sizing: border-box;
- }
- body {
- background-color: ghostwhite;
- }
- /* Set a style for all buttons */
- button, a {
- background-color: royalblue;
- color: white;
- padding: 14px 20px;
- margin: 8px 0;
- border: none;
- cursor: pointer;
- width: 100%;
- transition-duration: 0.4s;
- font-family: Arial;
- }
- button:hover, a:hover {
- background-color: cornflowerblue;
- box-shadow: 1px 1px 26px -2px rgba(0,0,0,0.75);
- }
- /* Extra styles for the cancel button */
- .cancelbtn {
- width: auto;
- padding: 10px 18px;
- background-color: #f44336;
- }
- /* Center the image and position the close button */
- .imgcontainer {
- text-align: center;
- margin: 24px 0 12px 0;
- position: relative;
- }
- #label1, #label2, #label3, #label4, #label5 {
- font-family: Arial;
- }
- img.avatar {
- width: 40%;
- border-radius: 50%;
- }
- .container {
- padding: 16px;
- }
- span.psw {
- float: right;
- padding-top: 16px;
- }
- /* The Modal (background) */
- .modal {
- display: none; /* Hidden by default */
- position: fixed; /* Stay in place */
- z-index: 1; /* Sit on top */
- left: 0;
- top: 0;
- width: 100%; /* Full width */
- height: 100%; /* Full height */
- overflow: auto; /* Enable scroll if needed */
- background-color: rgb(0,0,0); /* Fallback color */
- background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
- padding-top: 60px;
- }
- /* Modal Content/Box */
- .modal-content {
- background-color: #fefefe;
- margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */
- border: 1px solid #888;
- width: 80%; /* Could be more or less, depending on screen size */
- }
- /* The Close Button (x) */
- .close {
- position: absolute;
- right: 25px;
- top: 0;
- color: #000;
- font-size: 35px;
- font-weight: bold;
- }
- .close:hover,
- .close:focus {
- color: red;
- cursor: pointer;
- }
- /* Add Zoom Animation */
- .animate {
- -webkit-animation: animatezoom 0.6s;
- animation: animatezoom 0.6s
- }
- @-webkit-keyframes animatezoom {
- from {-webkit-transform: scale(0)}
- to {-webkit-transform: scale(1)}
- }
- @keyframes animatezoom {
- from {transform: scale(0)}
- to {transform: scale(1)}
- }
- /* Change styles for span and cancel button on extra small screens */
- @media screen and (max-width: 300px) {
- span.psw {
- display: block;
- float: none;
- }
- .cancelbtn {
- width: 100%;
- }
- }
- #selgitus1 {
- /*Ei lähe containerist välja*/
- min-width: 99.7%;
- max-width: 99.7%;
- }
- #bar01 {
- background-color: #eeeeee;
- margin: -10px;
- padding-right: 0px;
- }
- #tabel {
- font-family: verdana,arial,sans-serif;
- font-size:11px;
- color:#333333;
- border-width: 2px;
- border-color: #666666;
- border-collapse: collapse;
- }
- </style>
- <body>
- <!--NUPUD ÜLEVAL--><!--NUPUD ÜLEVAL--><!--NUPUD ÜLEVAL-->
- <!--NUPUD ÜLEVAL--><!--NUPUD ÜLEVAL--><!--NUPUD ÜLEVAL-->
- <!--NUPUD ÜLEVAL--><!--NUPUD ÜLEVAL--><!--NUPUD ÜLEVAL-->
- <div id="bar01" class="container">
- <button onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Andmed sisse</button>
- <button onclick="document.getElementById('id02').style.display='block'" style="width:auto;">Otsi</button>
- <button onclick="document.getElementById('id03').style.display='block'" style="width:auto;">Andmete tabel</button>
- </div>
- <!--ANDMED SISSE--><!--ANDMED SISSE--><!--ANDMED SISSE-->
- <!--ANDMED SISSE--><!--ANDMED SISSE--><!--ANDMED SISSE-->
- <!--ANDMED SISSE--><!--ANDMED SISSE--><!--ANDMED SISSE-->
- <div id="id01" class="modal">
- <form class="modal-content animate" action=" " method="post">
- <div class="imgcontainer">
- <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
- </div>
- <div class="container">
- <label id="label1"><b>Eesnimi</b></label>
- <input type="text" placeholder="Tudengi eesnimi" name="eesnimi" required>
- <label id="label2"><b>Perekonnanimi</b></label>
- <input type="text" placeholder="Tudengi perekonnanimi" name="perenimi" required>
- <label id="label3"><b>Isikukood</b></label>
- <input type="number" placeholder="Tudengi isikukood" name="isikukood" required>
- <textarea rows="5" cols="50" name= "selgitus" id="selgitus1">
- Tunnis toimunu selgitus.
- </textarea>
- <label id="label4"><b>Hinne</b></label>
- <select name="hinne">
- <option value="5">5</option>
- <option value="4">4</option>
- <option
- value="3">3</option>
- <option value="2">2</option>
- <option value="1">1</option>
- </select>
- <label id="label5"><b>Kursus</b></label>
- <select name="kursus" required>
- <option value="AV41">AV41</option>
- <option value="AV31">AV31</option>
- <option value="AV21">AV21</option>
- <option value="AV11">AV11</option>
- </select>
- <button type="submit" name="SubmitButton">Sisesta</button>
- </div>
- <div class="container" style="background-color:#f1f1f1">
- <!-- <button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Tagasi</button> -->
- </div>
- </form>
- </div>
- <!--OTSI--><!--OTSI--><!--OTSI-->
- <!--OTSI--><!--OTSI--><!--OTSI-->
- <!--OTSI--><!--OTSI--><!--OTSI-->
- <div id="id02" class="modal">
- <form class="modal-content animate" action=" " method="post">
- <div class="imgcontainer">
- <span onclick="document.getElementById('id02').style.display='none'" class="close" title="Close Modal">×</span>
- </div>
- <div class="container">
- <label id="label1"><b>Otsi tundengit tema eesnime järgi</b></label>
- <input type="text" placeholder="Tudengi eesnimi" name="otsi_nimi" id="otsi_nimi">
- <button type="submit" name="SearchButton" onclick="getData()" onsubmit="getData()">Otsi (nuppu uuesti vajutades kuvab kõik tulemused)</button> <!--NUPP-->
- <label id="label1"><b>Andmed kuvavad peale lehekülje värskendamist</b></label>
- <?php
- $otsi_nimi = $_POST['otsi_nimi'];
- $sql="SELECT * FROM andmed WHERE eesnimi LIKE '$otsi_nimi%';";
- $result = $conn->query($sql);
- ?>
- <table border="2" align="center" id="tabel">
- <thead>
- <tr>
- <th>Õpilase_ID</th>
- <th>Eesnimi</th>
- <th>Perekonnanimi</th>
- <th>Isikukood</th>
- <th>Kursus</th>
- </tr>
- </thead>
- <tbody>
- <?php
- while($row = $result->fetch_assoc()) {
- echo
- "<tr>
- <td>".$row["a_ID"]."</td>
- <td>".$row["eesnimi"]."</td>
- <td>".$row["perenimi"]."</td>
- <td>".$row["isikukood"]."</td>
- <td>".$row["kursus"]."</td>
- </tr>\n";
- }
- ?>
- </tbody>
- </div>
- <div class="container" style="background-color:#f1f1f1">
- <!-- <button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Tagasi</button> -->
- </div>
- </form>
- </div>
- <script>
- if (!is_array($error)) {
- // Get the modal
- var modal = document.getElementById('id01');
- // When the user clicks anywhere outside of the modal, close it
- window.onclick = function(event) {
- if (event.target == modal) {
- modal.style.display = "none";
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement