<?php
$conn = mysqli_connect('localhost', 'ksumanadhikari', 'welcome', 'age') or die("Connection failed");
if (isset($_POST['num'])) {
$num = $_POST['num'];
$sql = "INSERT INTO age(num) VALUES ('$num')";
mysqli_query($conn, $sql);
}
mysqli_close($conn);
?>
<html>
<body>
<form action="index.php" method="post">
<input type="number" name="num">
<input type="submit">
</form>
</body>
</html>
This code will give the output on Mysql when we insert any code inside the box it will add into the database.
The Database View
0 comments:
Post a Comment