pardipbhatti8791
2/2/2016 - 6:25 PM

register action file

register action file

<?php
// Action File

// Create Connection With Database

$conn = mysql_connect("localhost", "root", "") or die(mysql_error()."Error in server connection");
if($conn) {
  mysql_select_db("databaseName") or die(mysql_error()."Error in database conenction");
}

if($_POST['register']) {    // checking form submit button pressed

  $firstName = $_POST['firstName'];
  $lastName = $_POST['lastName'];
  $email = $_POST['email'];
  $password = $_POST['password'];
  
  $query = mysql_query("insert in tableName(firstName, lastName, email, password)values('$firstName', '$lastName', $email, $password)") or die(mysql_error()."Error in query");
  if($query) {
    echo "successfully registerd"; // or you can redirect user to login page
    // or
    header("location:login.php"); // redirect to another page
  } else {
    header("location:register.php?message=Oops ! Registration Failed");
  }
  
}
?>