updateform.php
본문
updateform php 소스 좀 구해줘세요
답변 2
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
<form action="update.php" method="post">
<div class="form-group">
<label for="id">ID:</label>
<input type="text" class="form-control" id="id" name="id">
</div>
<div class="form-group">
<label for="firstname">First Name:</label>
<input type="text" class="form-control" id="firstname" name="firstname">
</div>
<div class="form-group">
<label for="lastname">Last Name:</label>
<input type="text" class="form-control" id="lastname" name="lastname">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<html>
<head>
<title>Update Form</title>
</head>
<body>
<form action="update.php" method="post">
<label for="name">Name:</label>
<input type="text" name="name" /><br />
<label for="email">Email:</label>
<input type="text" name="email" /><br />
<label for="phone">Phone:</label>
<input type="text" name="phone" /><br />
<input type="submit" value="Update" />
</form>
</body>
</html>
답변을 작성하시기 전에 로그인 해주세요.