First save html file registration.html
my registraion form
| First Name | |
| last name | |
| 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);
}
}
}
?>
Leave a comment