Technical Knowledge

technical knowledge is that type of blogger in which you can find all the soluctions of your problems which you cannot solve you can see the video given on this blog and solve your problem by yourself.

Like us on Facebook

Technical Knowledge

Monday, March 23, 2015

How to make a working signup form


Step 1
The first thing were going to do is create a database were all our information will be stored
(the information that  a user submits )

1. Open phpmyadmin or any other online database manager
2. Click create table and name it as simple_login.
3. Then name the database as "simple_login".
4. After creating a database name, click the SQL and paste the below code.




Step 2
         


   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   


   


   
    $remarks=$_GET['remarks'];

    if ($remarks==null and $remarks=="")

    {

    echo 'Register Here';

    }

    if ($remarks=='success')

    {

    echo 'Registration Success';

    }

    ?>

   
First Name:
Last Name:
Gender:
Address:
Contact No.:
Picture:
Username:
Password:


   

         CREATE TABLE IF NOT EXISTS `member` ( `mem_id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, `password` varchar(30) NOT NULL, `fname` varchar(30) NOT NULL, `lname` varchar(30) NOT NULL, `address` varchar(100) NOT NULL, `contact` varchar(30) NOT NULL, `picture` varchar(100) NOT NULL, `gender` varchar(10) NOT NULL, PRIMARY KEY (`mem_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
' Now we have to create a form that the user will submit his data to create a form and save it as index.php. To create a form, open your HTML code editor and paste the code below after the html tag.

 



 step 3

Next step is to create a database connection and save it as "connection.php". This file is used to connect our form to database. This file serves as a bridge between our form and our database.

   
    $mysql_hostname = "localhost";
    $mysql_user = "root";
    $mysql_password = "";
    $mysql_database = "registration";
    $prefix = "";
    $bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
    mysql_select_db($mysql_database, $bd) or die("Could not select database");
    ?>
   
   
    Note:Replace the hostname with ur host name like wise user , password and dataabase name in the connection php
   
    Step 4
   
    Next step is to create our script that save our input data to database and save it as code_exec.php.



   
    session_start();
    include('connection.php');
    $fname=$_POST['fname'];
    $lname=$_POST['lname'];
    $mname=$_POST['mname'];
    $address=$_POST['address'];
    $contact=$_POST['contact'];
    $pic=$_POST['pic'];
    $username=$_POST['username'];
    $password=$_POST['password'];
    mysql_query("INSERT INTO member(fname, lname, gender, address, contact, picture, username, password)VALUES('$fname', '$lname', '$mname', '$address', '$contact', '$pic', '$username', '$password')");
    header("location: index.php?remarks=success");
    mysql_close($con);
    ?>
   
   
    Step 5
   
    To add some input validation using javascript, add the code below in the head tag of your index.php file. Input validation is used to make sure that all input field are filled out before saving the to database.
   
   

       
       
       
       
        Thats all we have to do you now just have to visit the index.php to ensure every thin is right
        Thanks for visit feel free to comment

No comments:

Post a Comment