Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <script>
- </script>
- <form action="<?php include 'file.php';?>" method="POST">
- <b>Busque Jรก</b>
- <input type="text" name="prestador" placeholder="prestador">
- <input type="text" name="cidade" placeholder="cidade">
- <input type="submit">
- </form>
- </body>
- </html>
- <?php
- $servername = "localhost";
- $username = "username";
- $password = "";
- $dbname = "test";
- $namer = $_POST['prestador'];
- $cities = $_POST['cidade'];
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT name,address,city FROM tb_prestadores WHERE name = '$namer' AND city = '$cities'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "name: " . $row['name']. " Endereço - : " . $row['address']." Cidade :".$row['city']."<br>";
- }
- } else {
- echo "It is going to else";
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement