The php code below is used to send the results of a form to a mysql database. T1 through T8 are the variables representing the text that people inputed into the form. What's supposed to happen is if they left any of the 5 fields (T1,T2,T3,T6,T8) blank then it shouldn't connect to the database and should print, "you didn't fill out all the info." If they did fill something out for those fields, it should update the database and print, "it finally worked." The problem is, it seems to update the database even if they left fields blank. Does anyone know why.
Thanks for the help
Adam
<?php
If (('$T1'=='') or ('$T2'=='') or ('$T3'=='') or ('$T6'=='') or ('$T8'==''))
{echo "You didn't fill out all the info";}
else
{$db=mysql_connect ("localhost","username","password");
mysql_select_db("observingyourmind_com",$db) or die ("can't connect");
mysql_query("INSERT INTO petition VALUES ('$T1','$T2','$T3','$T4','$T5','$T6','$T7','$T8',0)",$db) or die ("Insert didn't work");
mysql_close ($db) or die ("Can't close");
echo "It finally worked";}
?>