• Web Site Design

    A professional and beautiful website design is the result of creative talent and technical expertise. At Best IT web solutions India, technology meets creativity to produce quality web designs that not only attract, retain and improve user experience, but also generate higher revenues for your site.
  • E-Commerce Solutions

    E-commerce is an emerging face of the business world. We at Best IT Web Solutions, we build online business. We value our clients and breathe life into their e-commerce shopping carts so that they perform exceptionally well to deliver brilliant results.

PHP Login script – User Membership With PHP

Written by Sunil Kumar. Posted in PHP

Introduction

In this tutorial we are going to go through each step of making a user management system, along with an inter-user private messaging system. We are going to do this using PHP, with a MySQL database for storing all of the user information. This tutorial is aimed at absolute beginners to PHP, so no prior knowledge at all is required – in fact, you may get a little bored if you are an experienced PHP user!

This tutorial is intended as a basic introduction to Sessions, and to using Databases in PHP. Although the end result of this tutorial may not immediately seem useful to you, the skills that you gain from this tutorial will allow you to go on to produce a membership system of your own; suiting your own needs.

Before you begin this tutorial, make sure you have on hand the following information:

  • Database Hostname – this is the server that your database is hosted on, in most situations this will simply be ‘localhost’.
  • Database Name, Database Username, Database Password – before starting this tutorial you should create a MySQL database if you have the ability, or have on hand the information for connecting to an existing database. This information is needed throughout the tutorial.

If you don’t have this information then your hosting provider should be able to provide this to you.

Now that we’ve got the formalitiies out of the way, let’s get started on the tutorial!


Step 1 - Initial Configuration

Setting up the database

As stated in the Introduction, you need a database to continue past this point in the tutorial. To begin with we are going to make a table in this database to store our user information.

The table that we need will store our user information; for our purposes we will use a simple table, but it would be easy to store more information in extra columns if that is what you need. In our system we need the following four columns:

  • UserID (Primary Key)
  • Username
  • Password
  • EmailAddress

In database terms, a Primary Key is the field which uniquely identifies the row. In this case, UserID will be our Primary Key. As we want this to increment each time a user registers, we will use the special MySQL option – auto_increment.

The SQL query to create our table is included below, and will usually be run in the ‘SQL’ tab of phpMyAdmin.

 

CREATE TABLE `users` (
`UserID` INT(25) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`Username` VARCHAR(65) NOT NULL ,
`Password` VARCHAR(32) NOT NULL ,
`EmailAddress` VARCHAR(255) NOT NULL
);  

Best It Web Solutions PHP form to email explained

Written by Sunil Kumar. Posted in PHP

It is a common requirement to have a form on almost any web site.

In this article, we will create a PHP script that will send an email when a web form is submitted.

There are two parts for the web form:

  1. The HTML form code for the form. The HTML code below displays a standard form in the web browser.
  2. The PHP script for handling the form submission. The script receives the form submission and sends an email.

HTML code for the email form:

<form method="post" name="myemailform" action="form-to-email.php">

  Enter Name: <input type="text" name="name">

  Enter Email Address:    <input type="text" name="email">

  Enter Message:  <textarea name="message"></textarea>

  <input type="submit" value="Send Form">
  </form>