Please can you help. I have been trying create a form to insert some data into a database. (I am coding with PHP and MYSQL). When I put any data into the field called enter treatments completed the database gets updated with the treatments_completed column containing a 0 and then a record is made on the line underneath but with a zero in each column which is an int.
In addition I have been trying to check my form so that it goes to an error page if one of the fields has no value but it doesnt seem to do it.
This is my php/mysql code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.'' Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link rel="stylesheet" type="text/css" id="change" href="" />
<title>Laser-clear entry</title>
</head>
<body>
<?php
include ("conn.php");
$uniqueT=$_POST['uniqueidT'];
$fnameT=$_POST['fnameT'];
$snameT=$_POST['snameT'];
$tottreat=$_POST['tottreatT'];
$treatcom=$_POST['treatcomT'];
$ampay=$_POST['ampayT'];
$filelink=$_POST['filelink'];
/*$uniqueT= mysql_real_escape_string($uniqueT);
$fnameT= mysql_real_escape_string($fnameT);
$snameT= mysql_real_escape_string($snameT);
$tottreatT= mysql_real_escape_string($tottreatT);
$treatcom= mysql_real_escape_string($treatcomT);
$ampayT= mysql_real_escape_string($ampayT);
$filelinkT= mysql_real_escape_string($filelinkT); */
$sqlmm= "INSERT into person_info(unique_number, first_name,surname,total_treatments,treatments_completed,amount_paid,file_link) values ('$uniqueT' , '$fnameT' , '$snameT' , '$tottreat' , '$treatcom' , '$ampay' , '$filelink' )";
if ( $uniqueT == ' ' or $fnameT == ' ' or $snameT == ' ' or $tottreatT == ' ' or $tottreatT == ' ' or $treatcom == ' ' or $ampayT == ' ' or $filelinkT == ' ')
{
echo "error please enter data in all the boxes <br/>";
echo "<a href='laserclearentry.html'> click here to go back to entry page</a>";
}
else
{
mysql_query($sqlmm) or die(mysql_error());
echo "data successfully entered into the database <br/>";
echo "<a href='laserclearentry.html'> click here to go back to entry page</a>";
}
mysql_close($conn);
?>
</body>
</html>
These are the names of the columns in my database
unique_number first_name surname treatments_completed total_treatments amount_paid file_link