Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!Doctype html>
- <html>
- <head>
- <meta charset="utf-8"><!--characters recognised-->
- <title>Register</title>
- <style>
- body{
- background-image: url(my_images//background_homepage.jpg);
- background-repeat: no-repeat;
- background-size:cover;
- }
- </style>
- </head>
- <body>
- <?php
- extract( $_POST );//superglobal variable
- if( isset($_POST['submit'] ) ) {
- print_r($_POST);
- //Getting the variables from 'registerForm' ++ /* checking if user inputs are set */
- $first_name = (isset($_POST['fname'])) ? $_POST['fname'] : NULL;
- $last_name = (isset($_POST['lname'])) ? $_POST['lname'] : NULL;
- $age = (isset($_POST['age'])) ? $_POST['age'] : NULL;
- $job = (isset($_POST['job'])) ? $_POST['job'] :NULL;
- $email = (isset($_POST['mail'])) ? $_POST['mail'] : NULL;
- $username = (isset($_POST['username'])) ? $_POST['username'] : NULL;
- $password = (isset($_POST['password'])) ? $_POST['password'] : NULL;
- //INSERT INTO Query Creation
- $sqlQuery = "INSERT INTO registered_user ( age,email,fname,job,lname,password,username )
- VALUES ('$age','$email','$first_name','$job','$last_name','$password','$username')";
- //MySQL connection
- if( !( $database = mysql_connect( "localhost","root","" ) ) )//server name , a username , password
- die( "Couldn't connect to DB </body></html>" );//if false --> script gets terminated
- //Opening database "htmlproject"
- if( !mysql_select_db("htmlproject",$database) )//Database to be used , htmlproject
- die( "Couldnt open htmlproject db </body></html>" );
- //Query
- mysql_query( $sqlQuery, $database);
- if( !( $result = mysql_query( $sqlQuery, $database) ) )
- {
- print( "failed query! <br />" );
- die( mysql_error() . "</body></html>" );
- }else{
- print("success query!");
- }//end if
- //Free resources
- mysql_close( $database );
- }//end ifisset
- ?><!--end php script.To be executed by server-->
- <script type="text/javascript">//registration completed
- var r=window.confirm("registration completed");
- if( r == true){
- document.location.href = "HOMEPAGE.html";
- }else{
- document.location.href = "HOMEPAGE.html";
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement