There's a couple of issues, including that you are not actually moving the image into a upload directory - check out my modifications which include sanitizing your data
$username= "root";
$password= "";
$hostname= "localhost";
$allowed_ext = array( 'jpg', 'jpeg' );
$allowed_mime = array( 'image/jpeg' );
$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/uploads/';
$required = array( 'FullName', 'YourGender', 'AgeGroup', 'Institution', 'Purpose', 'NRC', 'Province', 'dbDate', 'Address');
$sanitized = array( );
$error = false;
foreach( $required as $req )
{
if( !isset($_POST[ $req ]) )
{
$error = true;
} else {
$sanitized[ $req ] = mysql_real_escape_string( $_POST[ $req ] );
}
}
if( $error )
{
die( 'Error - Not all required fields posted' );
}
if( !isset( $_FILES ) )
{
die( 'Error - No file sent' );
}
$imageName=mysql_real_escape_string($_FILES["image"]["name"]);
if( empty( $imageName ) )
{
die( 'Not image name set' );
}
$sanitized['Image'] = $imageName;
$imageType=mysql_real_escape_string($_FILES["image"]["type"]);
$extension=strtolower(substr($imageName, strpos($imageName, '.')+ 1));
if( !in_array($extension, $allowed_ext ) || !in_array($imageType, $allowed_mime) )
{
die( 'Only JPG images allowed' );
}
$imageData=mysql_real_escape_string($_FILES["image"]["tmp_name"]);
if( !move_uploaded_file($imageData, $upload_dir . $imageName ) )
{
die( 'Could not move file into upload directory' );
}
$dbhandle=mysql_connect($hostname, $username, $password) or die("could not connect to the database");
$selected=mysql_select_db("unic", $dbhandle);
$query = mysql_query("SELECT * FROM `students` WHERE `NRC`='" . $sanitized['NRC'] . "'");
if(mysql_num_rows($query) > 0)
{
echo ' The NRC you entered is already taken ';
}else{
mysql_query("INSERT INTO `students` (" . implode(',', array_keys($sanitized)) . ") VALUES ('" . implode( "','", $sanitized ) . "')");
echo("Record was Succesfully Entered");
}
mysql_close();