Как я могу отправить данные в свою базу данных
<?php include("connection.php"); ?> <!DOCTYPE html> <html> <head> <title>Home (Hotel Management)</title> <link rel="stylesheet" type="text/css" href="css/style.css"> <link relhref="img/HDlogo.jpg" type="img/icon" rec="icon"> </head> <body> <div id="full"> <div id="bg" style="background-image: url('img/bed.jpg'); height: 1200px;"> <div id="header"> <div id="logo"> <h1><font color="white">My Project</font></h1> </div> <div id="nav"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Contact Us</a></li> <li><a href="#">Book My Reservation</a></li> <li><a href="#">Our Hotel</a></li> <li><a href="#">Help</a></li> </ul> </div> </div> <div id="banner"> <div id="form"> <form action="room.php" method="post"> <table style="color: yellow;"> <tr> <td>Room No</td> <td><input type="text" name="rno" placeholder="Enter Room No" title="Enter Room No"></td> </tr> <tr> <td>Room Type</td> <td><input type="text" name="type" placeholder="Enter Room Type" title="Enter Room Type"></td> </tr> <tr> <td>Room Price</td> <td><input type="text" name="price" placeholder="Enter Room Price" title="Enter Room Price"></td> </tr> <td> <td><input style="width: 80px; height: 30px; border-radius: 20px; opacity: 0.7;" type="submit" name="submit" value="submit"></td> </td> </table> </form> <?php if(isset($_POST['submit'])) { $rno=$_POST['rno']; $type=$_POST['type']; $p=$_POST['price']; if(mysqli_query($a,"insert into room (rno,type,price) VALUES ('$rno','$type','$p')")) { echo "data insert"; } else { echo "Data not Inserted"; } } ?> </div> </div> </div> </div> </body> </html>
это и есть связь
<?php $a=mysqli_connect('localhost','root','','hd'); ?>
Что я уже пробовал:
<?php include("connection.php"); ?> <!DOCTYPE html> <html> <head> <title>Home (Hotel Management)</title> <link rel="stylesheet" type="text/css" href="css/style.css"> <link relhref="img/HDlogo.jpg" type="img/icon" rec="icon"> </head> <body> <div id="full"> <div id="bg" style="background-image: url('img/bed.jpg'); height: 1200px;"> <div id="header"> <div id="logo"> <h1><font color="white">My Project</font></h1> </div> <div id="nav"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Contact Us</a></li> <li><a href="#">Book My Reservation</a></li> <li><a href="#">Our Hotel</a></li> <li><a href="#">Help</a></li> </ul> </div> </div> <div id="banner"> <div id="form"> <form action="room.php" method="post"> <table style="color: yellow;"> <tr> <td>Room No</td> <td><input type="text" name="rno" placeholder="Enter Room No" title="Enter Room No"></td> </tr> <tr> <td>Room Type</td> <td><input type="text" name="type" placeholder="Enter Room Type" title="Enter Room Type"></td> </tr> <tr> <td>Room Price</td> <td><input type="text" name="price" placeholder="Enter Room Price" title="Enter Room Price"></td> </tr> <td> <td><input style="width: 80px; height: 30px; border-radius: 20px; opacity: 0.7;" type="submit" name="submit" value="submit"></td> </td> </table> </form> <?php if(isset($_POST['submit'])) { $rno=$_POST['rn']; $type=$_POST['type']; $p=$_POST['price']; if(mysqli_query($a,"insert into room(rno, type, price) VALUES ('$rno','$type','$p')")) { echo "data insert"; } else { echo "Data not Inserted"; } } ?> </div> </div> </div> </div> </body> </html>