I have two PHP files, 1 for form of registration and other for adding users.
When I am trying it, i am getting blank page when i press register button, please help.
Thanks in advance!
[B]Registration_form.php
[code=html]<!DOCTYPE html>
<html>
<head>
<script>
function validateForm()
{
var x=document.forms[“myForm”][“fname”].value;
var y=document.forms[“myForm”][“password”].value;
if (x==null || x==”” || y==null || y==”” || y.length < 4) {
if (x==null || x==””) {
document.getElementById(“FN”).innerHTML = “First name must be filled out”;
}
if (y==null || y==””) {
document.getElementById(“PW”).innerHTML = “Password must be filled out. <br>”;
}
if(y.length < 4 ) {
document.getElementById(“PW”).innerHTML = “Password must be at least 4 characters long. <br>”;
}
return false;
} // If ends here
}
</script>
</head>
<body>
<style>
#FN, #PW {
color: darkred;
width: 200px;
}
</style>
<form name=”myForm” id=”myForm” action=”registration_script.php” onsubmit=”return validateForm()” method=”post”>
<table><tr><td>First name:*</td><td><input type=”text” name=”fname”></td><td><div id=”FN”></div></td></tr>
<tr><td>Password:* </td><td><input type=”password” name=”password”></td><td><div id=”PW”></div></td></tr>
<tr><td><input type=”submit” value=”Submit”></td></tr>
</table>
</form>
<span style=”color:red”>Fields marked with asterisk ( * ) are required.</span>
</body>
</html>
[B]Registration_script.php
[code=php]<?php
//=============Configuring Server and Database=======
$db_host=’host.abc.com’;
$db_user=’user’;
$db_password = ‘pass’;
//=============Data Base Information=================
$db_database=’dbOfUsers’;
$con=mysql_connect($db_host,$db_user,$db_password);//or die(‘Server Information is not Correct’); //Establish Connection with Server
mysql_select_db($db_database, $con); //or die(‘Database Information is not correct’);
//===============End Server Configuration============
//=============Starting Registration Script==========
$userName=mysql_real_escape_string($_POST[‘fname’]);
$password=mysql_real_escape_string($_POST[‘password’]);
//=============To Encrypt Password===================
$password=md5($password);
//============New Variable of Password is Now with an Encrypted Value========
if(isset($_POST[‘btnRegister’])) //===When I will Set the Button to 1 or Press Button to register
{
$query=”insert into tbladmin(admin_usr_name,admin_pwd)values(‘$userName’,’$password’)”;
$res=mysql_query($query);
header(‘location:success_register.php’);
}
*
?>