下面的代码应该创建超链接到它的位置的医院名称,但是当我输出$ hyperlink变量发送时,它只是输出医院位置和医院名称。我正在使用notepad ++并在google chrome中运行我的代码。可能是PHP没有正确处理HTML。顺便说一句,它还连接html标签(在$ hyperlink内)作为输出的一部分。请帮忙
while($processtable=mysqli_fetch_assoc($fetchospitalperson)){
// $messagebody= "Patient Name: ".$processtable['firstname']." ".$processtable['fathername']." ".$processtable['lastname']." "."Hospital Name:";
$messagebody = "Patient Name: ".$processtable['firstname']." ".$processtable['fathername']." ".$processtable['lastname']." "."Hospital Name:".PHP_EOL;
//$hyperlink= new DOMDocument();
//$hyperlink->loadHTML("<html><body><a href='<".$processtable['geolocation']."'>" .$processtable['hospitalname']."</a></body></html>");
$hyperlink = "<html><body><a href='<".$processtable['geolocation']."'>".$processtable['hospitalname']."</a></body></html>".PHP_EOL;
//Name of the person that needs the blood transfusion along with hospital he is staying at,hyperlinked to its location
$string .= $messagebody." ".$hyperlink.PHP_EOL ;
}
$message= "Dear"." ".$firstname." ".$lastname.",".PHP_EOL .$string;
if(isset($sendtoperson)){
if(mail($to,$header,$message)){
echo "Sent";
}
else{ echo "Not sent";}
}