Hot File

How to PHP/MySQL/HTML Register Form

View: 287    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: MySQL   Fields: Other

0 point/2 review File has been tested

First we need to create a database to hold the user accounts. This is done through MySQL/PHPMyAdmin.

Introduction

This tutorial will cover creating a register form with PHP/MySQL/HTMl.

Steps of Creation:
Step 1:
First we need to create a database to hold the user accounts. This is done through MySQL/PHPMyAdmin.

On your localhost/web host cPanel/Control Panel go to MySQL Databases and create a new one (for example; the name of your site - Mine will be "tutorial"). Next go to PHPMyAdmin and select the created database.

Once you are on the database in PHPMyAdmin, create a table to hold the data - in this case it's our users accounts. Let's call it "users".

We want four columns;
[Name - Type - Length - Additionals...]

id - int - 5 - Auto Increment (A_I/AI) - Primary Key
username - varchar - 250
password - varchar - 250
email - varchar - 250

Click create and now we are ready to insert the data.

Step 2:
Now we can create a register form in HTML for the users...

<form action='register.php' method='POST'>
 <input type='text' name='user' />
 <input type='password' name='pass' />
 <input type='text' name='email' />
 <input type='submit' name='sentForm' />
</form>

As you can see, the method is POST which means the data is sent from the form invisible to the average user and the action is 'register.php' (which I have saved the page as, this avoids having to create two pages for one register function).

Step 3:
Since the action on the form is the same page, I will insert the following function in to the same page. If you have set a different page, insert the below source code in to that page instead.

?php
 mysql_connect('localhost', 'root', '');
 mysql_select_db('tutorial');
 if (isSet($_POST['sentForm'])) {
 if (isSet($_POST['user']) && isSet($_POST['email']) && isSet($_POST['pass'])) {
 $user = $_POST['user'];
 $pass = $_POST['pass'];
 $email = $_POST['email'];
 $query = mysql_query("INSERT INTO `users` VALUES ('', $user, $pass, $email)");
 if ($q) {
 echo 'Successful!';
 }
 }
 }
?>

The above script connects to the database with the given information (server, username, password) and selects our database containing the users table. Then we get the information from the form through our POST data and insert them in to the users table in our database as a new row.

Testing
Once you have finished, it should all be working. Try to create an account and check the database to see if the account/row exists

How to PHP/MySQL/HTML Register Form

How to PHP/MySQL/HTML Register Form Posted on 07-01-2016  First we need to create a database to hold the user accounts. This is done through MySQL/PHPMyAdmin. 5/10 287

Comment:

To comment you must be logged in members.

Files with category

  • SQL Query to Find Nth Highest Salary of Employee with java

    View: 280    Download: 0   Comment: 0   Author: none  

    SQL Query to Find Nth Highest Salary of Employee with java

    Category: MySQL
    Fields: Other

    0/0 review
    This is a very common interview question if you are going for the role at junior level. Most of the people learn it character by character, but few understand how this query works.

  • World OOP With PHP and MySQL

    View: 1040    Download: 0   Comment: 0   Author: none  

    World OOP With PHP and MySQL

    Category: MySQL
    Fields: Other

    0.32142857142857/14 review
    Setting up the skeleton of our class is fairly simple once we figure out exactly what we need.

  • How to Build a Newsletter System With PHP and MySQL

    View: 1324    Download: 0   Comment: 0   Author: none  

    How to Build a Newsletter System With PHP and MySQL

    Category: MySQL
    Fields: Other

    1.125/4 review
    When starting any project, I like to layout the folders before I start coding, so lets do that now.

  • Top 20+ MySQL Best Practices that can not be ignored

    View: 979    Download: 0   Comment: 0   Author: none  

    Top 20+ MySQL Best Practices that can not be ignored

    Category: MySQL
    Fields: Other

    1.6666666666667/3 review
    Database operations often tend to be the main bottleneck for most web applications today.

  • Create a PHP/MySQL Powered Forum from Scratch

    View: 1149    Download: 0   Comment: 0   Author: none  

    Create a PHP/MySQL Powered Forum from Scratch

    Category: MySQL
    Fields: Other

    1.5/3 review
    In this tutorial, we're going to build a PHP/MySQL powered forum from scratch.

  • Triggers Introduction to MySQL

    View: 328    Download: 0   Comment: 0   Author: none  

    Triggers Introduction to MySQL

    Category: MySQL
    Fields: Other

    1.6666666666667/3 review
    I would guess, even armed with this knowledge, that a good many of you are not taking advantage of triggers with MySQL.

  • How to Stored Procedures in MySQL 5

    View: 325    Download: 0   Comment: 0   Author: none  

    How to Stored Procedures in MySQL 5

    Category: MySQL
    Fields: Other

    2.25/2 review
    MySQL 5 introduced a plethora of new features - stored procedures being one of the most significant. In this tutorial, we will focus on what they are, and how they can make your life easier.

  • The strength of the PDO and. MySQLi: Which Should You Use?

    View: 330    Download: 0   Comment: 0   Author: none  

    The strength of the PDO and. MySQLi: Which Should You Use?

    Category: MySQL
    Fields: Other

    1.5/3 review
    When accessing a database in PHP, we have two choices: MySQLi and PDO. So what should you know before choosing one?

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd