I have a HTML form connecting to PHP and that submits it to the database. It works fine when all the fields in the form are filled…however, I put it so all the fields are not required in the HTML(I don’t mind leaving phone, wanted_sal and website blank)… so when the user leaves one field empty, the database doesn’t fill up. Nothing happens. I’m not sure if I need an if statement of sorts?
PHP Code:
// File Upload
include('conn.php');
$fileinfo=PATHINFO($_FILES["resume"]["name"]);
$newFilename=$fileinfo['filename'] ."_". time() . "." . $fileinfo['extension'];
move_uploaded_file($_FILES["resume"]["tmp_name"],"upload/" . $newFilename);
$location="upload/" . $newFilename;
// Application form $POST
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$birthday = $_POST['birthday'];
$gender = $_POST['gender'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$wanted_sal = $_POST['wanted_sal'];
$website = $_POST['website'];
$sql = mysqli_query($con,"insert into resume (cv_location, first_name, last_name, birthday, gender, phone, email, wanted_sal, website) values ('$location','$first_name', '$last_name', '$birthday', '$gender', '$phone', '$email', '$wanted_sal','$website')");