Home » Source Code » PHP tofu function » add_data.php

add_data.php ( File view )

  • By balalemuria 2015-07-02
  • View(s):0
  • Download(s):0
  • Point(s): 1
			<?php
include_once 'dbconfig.php';
if(isset($_POST['submit']))
{

$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$dateofbirth=$_POST['date'];
$email=$_POST['email'];
$address1=$_POST['address1'];
$city=$_POST['city'];
$mobileno=$_POST['mobile'];
$zipcode=$_POST['zipcode'];
$query1=mysql_query("insert into task(firstname,lastname,date,email,address1,city,mobile,zipcode) values('$firstname','$lastname','$dateofbirth','$email','$address1','$city','$mobileno','$zipcode')");
if($query1)
{

header("location:index.php");
echo "success";

}

else
{

echo "Registration failed";

}

}

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lemuria CRUD</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript">
function mail(pj)
      {

	var atpos=pj.indexOf("@");
	var dotpos=pj.lastIndexOf(".");
	return(atpos<dotpos && atpos>0 && pj.indexOf('@@')==-1 && dotpos>2 &&(pj.length - dotpos) >2);
     
}
function aaim(evt)
     {

        var j = (evt.which) ? evt.which : event.keyCode
        if (j > 31 && (j < 48 || j > 57))
        return false;
        return true;
     
}
function isValidImage(imagename)
     {

	imagefile_value = imagename;
	var checkimg    = imagefile_value.toLowerCase();
	if (!checkimg.match(/(\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG|\.jpeg|\.JPEG)$/))
	{

	return false;
	
}
	else
	{

	return true;
	
}
    
}

function check(form)
{


if(form.firstname.value=="")
{

document.getElementById("fname_err").innerHTML="Enter your first name";
form.firstname.focus();
return false;

}
else
{

document.getElementById("fname_err").innerHTML="";

}
if(form.lastname.value=="")
{

document.getElementById("lname_err").innerHTML="Enter your last name";
form.lastname.focus();
return false;

}
else
{

document.getElementById("lname_err").innerHTML="";

}
if(form.date.value=="")
{

document.getElementById("dob_err").innerHTML="Enter your Date of Birth";
form.date.focus();
return false;

}
else
{

document.getElementById("dob_err").innerHTML="";

}
if(form.email.value=="")
{

document.getElementById("mail_err").innerHTML="Enter your Email ID";
form.email.focus();
return false;

}
else
{

document.getElementById("mail_err").innerHTML="";

}
if(form.email.value!="" && mail(form.email.value)==false)
{

document.getElementById("mail_err").innerHTML="Enter your valid Email ID";
form.email.focus();
return false;

}
else
{

document.getElementById("mail_err").innerHTML="";

}
if(form.address1.value=="")
{

document.getElementById("address1_err").innerHTML="Enter your address";
form.address1.focus();
return false;

}
else
{

document.getElementById("address1_err").innerHTML="";

}
if(form.city.value=="")
{

document.getElementById("city_err").innerHTML="Enter your current city";
form.city.focus();
return false;

}
else
{

document.getElementById("city_err").innerHTML="";

}

if(form.mobile.value=="")
{

document.getElementById("mobileno_err").innerHTML="Enter your mobile no";
form.mobile.focus();
return false;

}
else
{

document.getElementById("mobileno_err").innerHTML="";

}


if(form.zipcode.value=="")
{

document.getElementById("code_err").innerHTML="Enter your Zipcode";
form.zipcode.focus();
return false;

}
else
{

document.getElementById("cod
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
01.97 kB
add_data.php5.19 kB2015-06-29|11:50
dbconfig.php158.00 B2015-06-26|09:51
edit_data.php5.74 kB2015-06-29|11:55
ico_delete.png691.00 B2010-08-05|09:07
index.php2.11 kB2015-06-29|12:07
pencil.png1.34 kB2012-07-26|20:12
style.css1.38 kB2015-06-29|11:28
task.sql1.50 kB2015-06-29|11:57
...
Sponsored links

add_data.php (8.42 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D