Let's think about the logic of things:
First step, we check if the user already voted - we check if the cookie is already set (beware that this is not very secure way to check that a user already voted, since a user can manually delete the cookie on his computer - you should probably combine this with the storage of the user IP and time of vote in a mysql table or a flat file on server side!);
anyway, let's get back to where we were.
if (isset($_COOKIE['mypoll'])) {
echo "You already voted!";
}
else {
//// user hasn't voted yet, so we display the form or process the form if the user pushed the submit
// we check if the form was submitted
if (isset($_POST['qid'])) { // if form was submitted
$mypoll = $_POST['qid'];
setcookie('mypoll', $mypoll , time()+2592000 );
// here you should store the value of the vote, together with the IP of user and time, in some mysql table or other sort of storage method so you can process the results later
echo "Thank you for your vote! Here are the results.....";
}
else {
// the form was not submitted, so you should show it to the user
// FORM FOR THE VOTE
}
}
This should do it.