Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- </head>
- <body>
- <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
- Customer Number: <input type="text" name="name" value="<?php echo $name;?>">
- <input type="submit" name="submit" value="Submit">
- </form>
- <?php
- $name = "";
- if ($_SERVER["REQUEST_METHOD"] == "POST") {
- if (!empty($_POST["name"])) {
- $name = $_POST["name"];
- }
- }
- $promenliva = "";
- $conn = mysqli_connect("127.0.0.1", "test_php", "TestPassword22.", "classicmodels");
- if (!$conn) {
- die("Connection failed: >>>" . mysqli_connect_error());
- }
- $sql = "select * from customers where customerNumber=".$name;
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- //echo "Customer Name: " . $row["customerName"]. " - Credit Limit: " . $row["creditLimit"]. "<br>";
- $promenliva=$row["customerName"];
- }
- } else {
- echo "0 results";
- }
- $conn->close();
- echo "<h2>Customer (company) name: </h2>"."<h1>".$promenliva."</h1>";
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement