I have this code below and i want to check if $lecname is empty. If its empty i get the echo statement however i still get the echo statement if its not empty. Is there an easy way to do this?
switch ($send) {
case "submitted":
echo "<table border = 1 width = 600>\n";
echo "<tr><th colspan=3 align=center bgcolor =\"#CCCCFF\">New Records Added</th><tr>";
echo "<tr><th width=200 bgcolor = \"#CCCCFF\">Lecture Name</td>
<th width=200 bgcolor = \"#CCCCFF\">Postscript URL</td>
<th width=200 bgcolor = \"#CCCCFF\">PDF URL</td>
</tr>";
if (empty($lecname[])){
echo "<tr><td colspan=3 align=center>You must enter a name</td></tr>";
exit;
}else{
for ($i = 0; $i < count($lecname); $i++ ){
$sql="Insert INTO lectures (name, url1, url2) values ('$lecname[$i]', '$lecurl1[$i]', '$lecurl2[$i]')";
if (!mysql_query($sql,$connection)) {
echo "error cannot add record..hit the back buton and try again !!!<br>";
exit;
} else {
echo "<tr><td>$lecname[$i]</td>
<td>$lecurl1[$i]</td>
<td>$lecurl2[$i]</td>
</tr>";
}}}
break;