Here is my coding. Basically i want to set form limitation based on user defined in ($result2). Another thing is the date. Eg. Today can submit 3 form then tomorrow can submit another 3 form until the user makes the changes on $result2. The problem from this code it will ignore the date and keep let user submit the form without the limit. Hope you guys can help, thanks
$name = $_POST['name'];
$address = $_POST['address'];
$contact = $_POST['contact'];
$email = $_POST['email'];
$tbl_name="torder";
$sql="INSERT INTO $tbl_name
(name,address,contact,email,orderdate)
VALUES('$name','$address','$contact','$email',now())";
$tbl2_name="tblfree";
$query="SELECT * FROM tblfree";
$result2=mysql_query($query);
$row = mysql_fetch_array(
mysql_query("SELECT COUNT(*) AS 'submit' FROM torder"));
if ($row['submit'] > $result2) {
echo 'We have reached our Free-T limit';}
else {
$result=mysql_query($sql);
echo 'success';
}