I have an job application form that sends an email with the information, and should also insert the values from the form (the values of which are imported into the handler.php seen below at the top) into a table in a database on the server.
However, it's not inserting the values, and I can't figure out why.
I actually took this script from my client's old version of the website on a different domain and server, and it's still working perfectly on that one, so I can't figure out why it's not working here. The only thing I've changed is the database details. At one point I thought the issue might be because mysql_connect etc. is deprecated in favour of mysqli-equivalents, but the client's server is still running PHP 5.3, so that shouldn't be the issue.
Via PHPMyAdmin, I have a database, and a table called 'team'. I create all the columns according to the original setup on the old website, so that each item you see in the INSEERT query down below will have somewhere to go.
Am I missing something in my SQL connection code? The username, password, domain and database are all correct...
$date = date("d/M/Y");
$name = Trim(stripslashes($_POST['name']));
$dob = Trim(stripslashes($_POST['dob']));
$contact = Trim(stripslashes($_POST['contact']));
$email = Trim(stripslashes($_POST['email']));
$preferredCity = Trim(stripslashes($_POST['preferredCity']));
$nightsMo = Trim(stripslashes($_POST['nightsMo']));
$nightsTu = Trim(stripslashes($_POST['nightsTu']));
$nightsWe = Trim(stripslashes($_POST['nightsWe']));
$nightsTh = Trim(stripslashes($_POST['nightsTh']));
$nightsFr = Trim(stripslashes($_POST['nightsFr']));
$nightsSa = Trim(stripslashes($_POST['nightsSa']));
$nightsSu = Trim(stripslashes($_POST['nightsSu']));
$ownCar = Trim(stripslashes($_POST['ownCar']));
$previousWork = Trim(stripslashes($_POST['previousWork']));
if (Trim($nightsMo)=="") $nightsMo="NULL";
if (Trim($nightsTu)=="") $nightsTu="NULL";
if (Trim($nightsWe)=="") $nightsWe="NULL";
if (Trim($nightsTh)=="") $nightsTh="NULL";
if (Trim($nightsFr)=="") $nightsFr="NULL";
if (Trim($nightsSa)=="") $nightsSa="NULL";
if (Trim($nightsSu)=="") $nightsSu="NULL";
if (Trim($ownCar)=="") $ownCar="NULL";
$username="XXX";
$password="XXX";
$database="XXX";
mysql_connect("example.co.uk",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
mysql_query("INSERT INTO team (t_date, t_name, t_dob, t_contact, t_email, t_preferredCity, t_nightsMo, t_nightsTu, t_nightsWe, t_nightsTh, t_nightsFr, t_nightsSa, t_nightsSu, t_ownCar, t_previousWork, t_picture) VALUES ('$date', '$name','$dob','$contact','$email','$preferredCity',$nightsMo,$nightsTu,$nightsWe,$nightsTh,$nightsFr,$nightsSa,$nightsSu,$ownCar,'$previousWork', '$filePath')");
mysql_close();