Html Registration form with java script validation and image upload in php


First save  html file registration.html

my registraion form

First Name
last name
Email
Telephone:
Address
user name
passsword
gender male
female
education ug
pg
Your Region Choose one
North America
South America
Africa
Europe
Asia
image

<?php
if(isset($_FILES[“image”][“tmp_name”]))
{
$type = $_FILES[“image”][“type”];
$size = $_FILES[“image”][“size”];
if(($type==”image/jpeg”)&&($size<800000))
{
$error = FALSE;
$photo = $_FILES[“image”][“tmp_name”];
$connect = mysql_connect(“localhost”,”pramodh”,””)or die(“cant connect to mysql”);
mysql_select_db(“pramodh”);
$file1=file_get_contents($photo);
$file=mysql_real_escape_string($file1);
$sql_query=”INSERT INTO reg(FirstName, LastName,EMAIL,TELEPHONE,ADDRESS,USERNAME,PASSWORD,GENDER,EDUCATION,REGION,IMAGE)
VALUES (‘$_POST[fname]’,’$_POST[sname]’,’$_POST[email]’,’$_POST[telephone]’,’$_POST[Address]’,’$_POST[username]’,’$_POST[password]’,’$_POST[reg]’,’$_POST[reg1]’,’$_POST[region]’,’$file’)”;
mysql_query($sql_query)or $error = mysql_error();
if($error)
{
echo “$error”;
include(“registrationform.html”);
}
else
{
echo “successfully registered”;
mysql_close($connect);
}
}
}
?>

Advertisements
About

myself pramodh kumar yet another php developer from India and have worked on oops,procedural,yii framework,codeigniter,wordpress,joomla,api and more.

Tagged with: , , , , , , , , , , , , , ,
Posted in Html Registration form with java script validation and image upload

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow php tutorial on WordPress.com
categories
Calendar
June 2012
M T W T F S S
    Jul »
 123
45678910
11121314151617
18192021222324
252627282930  
Follow me on Twitter
Blog Stats
  • 74,625 hits
%d bloggers like this: