Forum Moderators: coopster
<?php
$surname = $_POST['surname'];
$firstname = $_POST['firstname'];
$othernames = $_POST['othernames'];
$dateofbirth = $_POST['dateofbirth'];
$placeofbirth = $_POST['placeofbirth'];
// process form
$link = mysql_connect("localhost", "root","pass");
mysql_select_db("base", $link);
$sql = "INSERT INTO `recruitment` (`surname`,`firstname`,`othernames`,`dateofbirth`,`placeofbirth`)
VALUES ('$surname', '$firstname', '$othernames', '$dateofbirth', '$placeofbirth');";
$result = mysql_query($sql);
// print a success message
echo " Thank you $firstname $surname, for submitting your data<br>";
?>
On your form add a input box like <input name="passport" type="file" id="passport" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9px">
No , when submit is pressed in your php code add
$passport = $_FILES['passport']['name']; (This also serves as the check if they have chosen to upload a file)
$filepath = "passportsfile/";
and finally
copy ($_FILES['passport']['tmp_name'], "" . $filepath . "".$_FILES['passport']['name']);
Also make sure the directory you choose have the appropriate rights
Thats it