a) In admin/posting there is this setting: Allow questions to be related to answers​. If it is enabled you'll see another button in the answers that allow to ask a related question. This redirects you to the ask page but adds the follow parameter in the URL. This means you go to the ask page this way: http://www.question2answer.org/qa/ask?follow=44021
The 44021 is the ID of the answer that the question will be related to.
b) If there is a post related to the answer, then it is fetched from the DB, using the ID in $followpostid. The thing is that you don't actually know much about it. Maybe the post didn't exist. Maybe the post is not an answer (it could be, e.g., a question). So you need to be as sure as possible you're doing things the right way.
So, without using the (discouraged) @ operator, these checks can be made this way:
if (!isset($followanswer['basetype']) || $followanswer['basetype'] !== 'A') {
$followanswer = null;
}
First condition checks $followanswer is not null and is an array which contains a basetype key, which means the post exists. Second condition checks the post is not an answer. So if any of them are true, then the $followanswer variable is null which means the question is not linked to an answer.