The error is here
mysql_query($q,$connect);
Try chaging the query to this
$q="Select authorid from authors where AuthorName='$author'";
Probably its because of the missing '' or simply, you´re not getting the POST variable authorname
Try this
$author=$_POST["authorname"];
echo $author;
Do you get what you expect?
If nothing of this works, then you have a problem in $connect
Cheers