关闭php标记并在html标记内处理php数据后,无法追加字符串的其余部分

关闭php标记并在html标记内处理php数据后,无法追加字符串的其余部分,php,html,sql,Php,Html,Sql,我正在尝试向用户发送邮件,该用户将患者姓名和医院名称超链接到其在数据库中的位置。message body变量最多只接受字符串hospital name,不会将医院名称附加到其在地图上的位置。请帮忙。提前谢谢 //Take contents of the search box if($name=file_get_contents('file.txt')) { //create a temp file in bloodonation and take the name from ther

我正在尝试向用户发送邮件,该用户将患者姓名和医院名称超链接到其在数据库中的位置。message body变量最多只接受字符串hospital name,不会将医院名称附加到其在地图上的位置。请帮忙。提前谢谢

    //Take contents of the search box
if($name=file_get_contents('file.txt')) {   //create a temp file in bloodonation and take the name from there,then delete the temp file
    $multiple= explode(',',$name);
    $firstname = $multiple[0]; // firstname                                                                                                   
    $fathername = $multiple[1]; // fathername
    $lastname = $multiple[2]; // lastname    
    unlink('file.txt'); 
    $query ="SELECT email
        FROM personprofile
        WHERE   firstname= '$firstname' AND lastname= '$lastname' AND fathername= '$fathername'";
        $fetchemail=  mysqli_query($link,$query);
        $process=mysqli_fetch_assoc($fetchemail);
        //mail function parameters, send two sets of messages depending on blood/organ donation
        // create a new paitent with the city beirut and check the mail results
        $to=$process['email'];
        $header= "Blood is urgently needed";
        $phquery="SELECT personprofile.firstname,personprofile.lastname,personprofile.fathername,hospital.hospitalname,hospital.geolocation 
        FROM personprofile,hospital,areaname 
        WHERE areaname.id= hospital.area AND personprofile.hospitaladmission= hospital.id AND areaname.area='$city'";
        $fetchospitalperson=  mysqli_query($link,$phquery);
        $processtable=mysqli_fetch_assoc($fetchospitalperson);
        $messagebody= "Patient Name: ".$processtable['firstname']." ".$processtable['fathername']." ".$processtable['lastname']."  "."Hospital Name:" ?>
        <html><body>
        <a href="<?php $processtable['geolocation']?>" >
        <?php " ".$processtable['hospitalname'];?>
        </a></body></html> 
        <?php //Name of the person that needs the blood transfusion along with hospital he is staying at,hyperlinked to its location
        $message= "Dear"." ".$firstname." ".$lastname.",".PHP_EOL .$messagebody; 
    if(isset($sendtoperson)){   
        if(mail($to,$header,$message)){
            echo "Sent";
        }
        else{ echo "Not sent";}
    }   
}

亲爱的上帝,请告诉我你是一名学生。不会做任何事情,你需要回显。不回显,OP是关于发送HTML和邮件,内容应该在$message中。此代码非常不安全。在对数据库执行任何其他操作之前,请先阅读SQL注入攻击。阅读有关提高安全性的内容!嘿,伙计们,谢谢你们的帮助。地理位置应超链接到从数据库中提取的医院名称
<?php
    $messagebodyA = "Patient Name: ".$processtable['firstname']." ";
    $messagebodyA .= $processtable['fathername']." ";
    $messagebodyA .= $processtable['lastname']." ";
    $messagebodyA .= "Hospital Name: ".$processtable['hospitalname'];

    $messagebody = "<html><body>";
    $messagebody .= '<a href="' .$processtable['geolocation']. '">'; // Note single quotes to allow double quotes in html tag
    $messagebody .= $processtable['hospitalname'];
    $messagebody .= "</a><br><br>";
    $messagebody .= "Dear ".$firstname." ".$lastname.",<br><br>".$messagebodyA;
    $messagebody .= "</body></html>";


    $message = $messagebody; // to be compliant with the rest of the code
?>