,
Share this with your friends 
 

code to create a sign up form in PHP Mysql

0 ratings Views 214 
Author: Lovely_28cc5780 (Lovely Chakraborty)  View Profile |  View other solutions by this author

Question / Problem


What is the code in PHP MYSQL to create a sign up form??

Solution

<?php
session_start();
if(isset($_POST['signup2']))
{
//echo "<script type='text/javascript' >alert('Account not activated Incorrect user name or password. Please try again')</script>";
//header("Location: faculty_home.php");
//echo 'kbkhbhjbjh';
include('db_connect.php');
if (!$dbCon) {
die("Error");}
$error = array();//Declare An Array to store any error message
$catagory=$_POST['catagory'];
$dept=$_POST['department'];
$name = $_POST['namesignup'];
$email = $_POST['emailsignup'];
$reg_no=$_POST['regNosignup'];
$dob=$_POST['dob'];
$user_name = $_POST['usernamesignup'];//else assign it a variable
if ($_POST['passwordsignup']==$_POST['passwordsignup_confirm'])
{
$passwrd=$_POST['passwordsignup'];
}
else
{
$error[]="Password miss match enter again<br>";
die();
}

if(empty($error))
{

if($catagory=="3")
{
$sql="INSERT INTO staffs(name,emailid,employeeID,dob) VALUES('$name','$email','$reg_no','$dob');";
$sql.="INSERT INTO verification(registerno,username,password,catagory) VALUES('$reg_no','$user_name','$passwrd','$catagory');";
$sql.="INSERT INTO card(registerno) VALUES('$reg_no');";
$sql.="INSERT INTO images(id) VALUES('$reg_no');";
$sql.="INSERT INTO wallet(registerno) VALUES('$reg_no');";
$sql.="INSERT INTO notification(registerno) VALUES('$reg_no');";
$query=mysqli_multi_query($dbCon,$sql);
if($query)
{
header("Location: index.php?action=joined");
echo "Data inserted Succesfully";
}

if(!$query )
{
die('Could not enter data: c3 ' . mysql_error());
}
}
else if($catagory=="2")
{
$sql= "INSERT INTO faculty(name,emailid,employeeID,dob,department) VALUES('$name','$email','$reg_no','$dob','$dept');";
$sql.="INSERT INTO verification(registerno,username,password,catagory) VALUES('$reg_no','$user_name','$passwrd','$catagory');";
$sql.="INSERT INTO card(registerno) VALUES('$reg_no');";
$sql.="INSERT INTO wallet(registerno) VALUES('$reg_no');";
$sql.="INSERT INTO images(id) VALUES('$reg_no');";
$sql.="INSERT INTO notification(registerno) VALUES('$reg_no')";
$query=mysqli_multi_query($dbCon,$sql);

if($query)
{
header("Location: index.php?action=joined");
echo "Data inserted Succesfully";
}

if(!$query )
{
die('Could not enter data: ' . mysql_error());
}
}
else if($catagory=="1")
{
$sql="INSERT INTO students(name,emailid,registerno,dob,department) VALUES('$name','$email','$reg_no','$dob','$dept');";
$sql.="INSERT INTO verification(registerno,username,password,catagory) VALUES('$reg_no','$user_name','$passwrd','$catagory');";
$sql.="INSERT INTO card(registerno) VALUES('$reg_no');";
$sql.="INSERT INTO wallet(registerno) VALUES('$reg_no');";
$sql.="INSERT INTO mark(registerno) VALUES('$reg_no');";
$sql.="INSERT INTO images(id) VALUES('$reg_no');";
$sql.="INSERT INTO notification(registerno) VALUES('$reg_no')";
$query=mysqli_multi_query($dbCon,$sql);

if($query)
{
header("Location: index.php?action=joined");
echo "Data inserted Succesfully";
}

if(!$query )
{
die('Could not enter data:c1 ' . mysql_error());
}
}
}

else
{
die();
}
}
//else{
// echo "<script type='text/javascript' >alert('Account not activated Incorrect user name or password. Please try again')</script>";
// header("Location: faculty_home.php");
//}



?>

Applies to

PHP

Rank It

Login to rank it

Report


Advertisement