Results 1 to 5 of 5

Thread: Form and script PHP

Threaded View

  1. #1
    Join Date
    Oct 2012
    Gujarat, India.

    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!


    HTML Code:
    <!DOCTYPE html>
    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
    #FN, #PW {
    color: darkred;
    width: 200px;
    <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>
    <span style="color:red">Fields marked with asterisk ( * ) are required.</span>

    PHP Code:
    //=============Configuring Server and Database=======
    $db_password 'pass';
    //=============Data Base Information=================
    $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==========
    //=============To Encrypt 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')";
    Last edited by deepode; 10-17-2012 at 10:12 AM. Reason: old error resolved, new one!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center