Created
November 14, 2017 15:21
-
-
Save webdevid/0f16e354358071a2fc2647edf26fdda0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $servername = "localhost"; | |
| $username = "root"; | |
| $password = "root"; | |
| $dbname = "local"; | |
| // Create connection | |
| $conn = mysqli_connect($servername, $username, $password, $dbname); | |
| // Check connection | |
| if (!$conn) { | |
| die("Connection failed: " . mysqli_connect_error()); | |
| } | |
| if($_POST['proses']=='daftar'){ | |
| $nama = $_POST['nama']; | |
| $email = $_POST['email']; | |
| $password = md5($_POST['password']); | |
| echo $nama.'-'.$email.'-'.$password; | |
| // sql query simpen ke database | |
| // redirect halaman list mahasiswi | |
| $sql = "INSERT INTO mahasiswi_imoet (nama, email, password) VALUES ('$nama' , '$email', '$password')"; | |
| if (mysqli_query($conn, $sql)) { | |
| echo "New record created successfully"; | |
| } else { | |
| echo "Error: " . $sql . "<br>" . mysqli_error($conn); | |
| } | |
| mysqli_close($conn); | |
| header('Location: index.php'); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment