Created
May 26, 2017 05:50
-
-
Save donrokzon/5d7a796c0a910cd1f0d9bd7066e124d7 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
| <!DOCTYPE HTML> | |
| <html> | |
| <body> | |
| <form method="post" action="volleyRegister.php"> | |
| Name: <input type="text" name="username"><br> | |
| E-mail: <input type="text" name="email"><br> | |
| Password: <input type="text" name="password"><br> | |
| <input type="submit"> | |
| </form> | |
| </body> | |
| </html> | |
| server | |
| <?php | |
| if($_SERVER['REQUEST_METHOD']=='POST'){ | |
| $username = $_POST['username']; | |
| $email = $_POST['email']; | |
| $password = $_POST['password']; | |
| define('HOST','localhost'); | |
| define('USER','root'); | |
| define('PASS','root'); | |
| define('DB','volleyDb'); | |
| $con = mysqli_connect(HOST,USER,PASS,DB) or die('Unable to Connect'); | |
| // Check connection | |
| if ($conn->connect_error) { | |
| die("Connection failed: " . $conn->connect_error); | |
| } | |
| echo "Connected successfully,"; | |
| $sql = "INSERT INTO register (username,password,email) VALUES ('$username','$password','$email')"; | |
| if(mysqli_query($con,$sql)){ | |
| echo "Successfully Inserted"; | |
| }else{ | |
| echo "Could not Insert"; | |
| } | |
| }else{ | |
| echo 'error'; | |
| } | |
| ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment