Where can I get a data entry form template using HTML?

Asked By 0 points N/A Posted on -
qa-featured

Hi. I need to have a data entry form template using HTML for my website. Preferably, the form should have the capacity to accept user inputs. Can you tell me what site should I visit so that I could pick styles and layout for my forms? What other alternatives should I consider aside from buying templates in the internet? Thanks.

SHARE
Answered By 0 points N/A #167834

Where can I get a data entry form template using HTML?

qa-featured

Hello Kurtt,

There are many online forums and websites which provide templates for data entry forms. You can also use content management systems, code generating software to generate the data entry forms. You just need to go to a search engine and search for form templates or codes for generating data entry forms.

The other way is to write up your own code for the data entry form. You will need to create a HTML form and use JavaScript or PHP scripting language to validate the form entries. An example can be as shown below:

form.php file

<table class="bg4">
    <form method="post" action="validate.php">    
    <tr><td width="145">Names:</td><td width="300"><input type="text" size="45" name="nicename"/></td></tr>
    <tr><td width="145">Gender:</td><td width="300"><select size="1" name="gender"> <option>Male</option><option>Female</option></select> </td></tr>
    <tr><td width="145">Location:</td><td width="300"><input type="text" size="45" name="location"/></td></tr>              
    <tr><td width="145">Email:</td><td width="300"><input type="text" size="45" name="email"/></td></tr>
    <tr><td width="145">Username:</td><td width="300"><input type="text" size="45" name="username"/></td></tr>      
    <tr><td width="145">Password:</td><td width="300"><input type="password" size="45" name="password"/></td></tr>
    <tr><td width="145">Confirm Password:</td><td width="300"><input type="password" size="45" name="confirm"/> </td></tr> 
    <tr><td width="145"></td><td width="300"><input type="submit" value="Register"class='buttons'></td></tr>
                </form>             
                </table>   

validate.php

<?php
/* This code will make a connection with database */
$con=mysql_connect("localhost","root","");
 
/* Now, we select the database */
mysql_select_db("amboseli");
 
/* Now we will store the values submitted by form in variable */
$nicename=$_POST['nicename'];
$gender=$_POST['gender'];
$location=$_POST['location'];
$email=$_POST['email'];
$username=$_POST['username'];
$password=$_POST['password'];
$confirm=$_POST['confirm'];

 function died($error) {
        // your error code can go here
        echo "<div class='errmsg'>We are very sorry, there were error(s) found with the form you submitted.<br />";
        echo $error."<br>";
         include 'signup.php';
        die();
      
    }   
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email)) {
    $error_message .= 'The Email Address you entered is invalid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$location)) {
    $error_message .= 'The Location you entered is invalid.<br />';
    }
  if(strlen($password) < 4) {
    $error_message .= 'Please enter a valid password which is atleast 4 characters long.<br /></div> ';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    
     
    
 
/* Now we will check if username is already in use or not */
$queryuser=mysql_query("SELECT * FROM user WHERE username='$username' ");
$checkuser=mysql_num_rows($queryuser);
    
if($checkuser != 0)
{ echo "<div class='errmsg'>Sorry, the username is already taken.Please choose another username</div>";
 include 'signup.php';}
else {
 
/* now we will check if password and confirm password matched */
if($password !== $confirm)
{ echo "<div class='errmsg'>Passwords do not match.</div>";
 include 'signup.php';}
else {
 
/* Now we will write a query to insert user details into database */
$insert_members=mysql_query("INSERT INTO user ( nicename, gender, location, email, username, password) VALUES ('$nicename', '$gender', '$location', '$email', '$username', SHA1('$password'))");

if($insert_members)
{
 echo "<div class='finemsg'> Registration successful</div>";
 header('Location:login.php');
 }
else
{ echo "<div class='errmsg'>error in registration</div>".mysql_error();
 include 'signup.php';
 
/* closing the if else statements */
}}}
 
mysql_close($con);
?>

Login/Register to Answer

Related Questions