/    Sign up×
Community /Pin to ProfileBookmark

Form and script PHP

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[/B]

[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>
[/code]

[B]Registration_script.php[/B]

[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’);
}
*
?>
[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@hastxOct 17.2012 — The asterisk there at the end of the script? Try at the beginning

[code=php]
error_reporting(E_ALL);
ini_set('display_errors','On');
[/code]


and at the end:

[code=php]
header('Location: success_register.php');
exit();
[/code]
Copy linkTweet thisAlerts:
@deepodeauthorOct 17.2012 — sorry, i got what was problem, for new problem i have created new thread please check it.
Copy linkTweet thisAlerts:
@hastxOct 17.2012 — If the thread is resolved, please mark it that way...and document the solution out of courtesy for other users looking for help, so their browsing here is not useless.
Copy linkTweet thisAlerts:
@deepodeauthorOct 17.2012 — sorry but that still doesn't solves problem! I have changed all scripts.
×

Success!

Help @deepode spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...