How to create a form save the value to the database?

Posted on Updated on

Save the value in database

To create a form to insert to the database we need 3 things

Html

Php (or any intermediate language like java etc)

Mysqli (database,tables)

Here we now start open wampserver and www folder into the c drive and create a folder over there and now open a notepad file create a form like:

<form enctype=”multipart/form-data” action=”<?php echo $_SERVER[‘PHP_SELF’];?>” method=”post”>

 

job description

Logo:

job posting title

 

 

number of vancancies

 

 

work loc_ation

 

 

city

 

 

job description

 

 

..requir_ements.

 

 

minimum experience

more than ten years

internship

without experience

one year

between 3-5 year

 

 

minimum studies

BA

LLB

BCA

B.COM

BTECH

BHM

BBA

 

contract details

 

position type

permanent

internship

temporary

for project

other

 

 

contact

duration

fulltime

parttime-morning

parttime-evening

 

 

EXP Date: 

 

 

salary

 

</form>

Here is the html code now putt the php code

<?php

if(isset($_POST[‘ok’]))

{

$exp_date=$_POST[‘date_exp’];

$posting_date=date(’20y-m-d’);

//echo $exp_date;

$title=$_POST[‘title’];

$img=$_FILES[‘logo’][‘name’];

//echo $img;

if(!move_uploaded_file($_FILES[‘logo’][‘tmp_name’],”upload_logo/”.$_FILES[‘logo’][‘name’]))

{

echo “error in upload”;

}

$van=$_POST[‘vancancies’];

$worklocation=$_POST[‘worklocation’];

$city=$_POST[‘city’];

$des=$_POST[‘description’];

$require=$_POST[‘require’];

$exp=$_POST[‘experience’];

$std=$_POST[‘studies’];

$position=$_POST[‘position’];

$contact=$_POST[‘contact’];

$shift=$_POST[‘shift’];

$salary=$_POST[‘salary’];

$con=mysqli_connect(“localhost”,”root”,””,”job_portal_database”);

$a=mysqli_query($con,”insert into jobs(`date_exp`,`posting_date`,`image`, `title`, `vancancies`,

`location`, `city`, `description`, `require`, `experience`, `studies`, `position_type`, `contact`, `shift`,

`salary`)values(‘$exp_date’,’$posting_date’,’$img’,’$title’,’$van’,’$worklocation’,’$city’,’$des’,’$require’,’$

exp’,’$std’,’$position’,’$contact’,’$shift’,’$salary’)”);

if(!$a)die(“error”.mysqli_error($con));

mysqli_close($con);

}

?>

It will insert the value into the table.

For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.

Helpline: 9814666333, 8699444666

Email:info@technocampus.co.in

**************************************************************************************************************

Please fill the FORM and we shall contact you soon.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

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