使用此示例Add php variable inside echo statement as href link address?,
我可以从我的SQL DB中获取一个电子邮件地址,并使其在我的表单中可点击。 HTML看起来像这样:
联系方式:blahblah@gmail.com
但是当我将鼠标悬停在if上或单击它时,它会在其之前添加我的域名。所以点击上面的内容会尝试转到:
http://mydomainname.com/blahblah@gmail.com
以下是一些生成链接的代码
while($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
ob_start();
echo "
....
<div class='eventContact'>Contact: <a href='".$tempcontact."'>$tempcontact</a></br></div>
";
ob_end_clean();
}
我猜它不应该是'a href'但不确定它应该是什么。
答案 0 :(得分:0)
As I said in the comment:
Change it to mailto:youremail@emailaddress.com
-this will fire the users email client
<a href="mailto:youremail@emailaddress.com">Email me</a>
You can then set the subject of the email too if you want
<a href="mailto:youremail@emailaddress.com?Subject=Hi">Email me</a>