Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "test";
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- else{
- $no=$_POST['No'];
- $name=$_POST['nama'];
- $TL=$_POST['TL'];
- $TGLLH=$_POST['date'];
- $HB=$_POST['HB'];
- $sql = "INSERT INTO myfamily (`No`,`nama`, `t4lahir`, `tgl_lahir`, `hobby`) VALUES ('$no','$name','$TL','$TGLLH','$HB')";
- if (mysqli_query($conn, $sql)) {
- echo "<script>alert('Data berhasil di tambahkan!');history.go(-1);</script>";
- } else
- {
- echo "<script>alert('Hello How are you?');history.go(-1);</script>";
- }
- mysqli_close($conn);
- }
- ?>
Add Comment
Please, Sign In to add comment