-1

我已经制作了这张表格,您可以在其中写下您的姓名、姓氏、电话和电子邮件。使用 HTML 和 PHP。

name: "textfield here"
lastname: "textfield here"
phone: "textfield here"
email: "textfield here"

我的PHP代码:

 echo "<H1>Hello " .$_POST['name']. " " .$_POST['surname']; 

 echo "I'm calling you at " .$_POST['telephone']. " or email you at ".$_POST['email']; 

如何使结果email作为超链接出来?

4

4 回答 4

2

要创建链接,请使用<a>标签,对于电子邮件链接,您可以将其设置hrefmailto:xyz.

邮寄参考

还要考虑研究 XSS,因为您的代码很容易受到攻击。注意下面的使用htmlentities()来防止 XSS。

echo "<h1>Hello " .htmlentities($_POST['name']). " " .htmlentities($_POST['surname']) . "</h1>"; 

echo "<p>I'm calling you at " .htmlentities($_POST['telephone']). " or email you at <a href=\"mailto:" . htmlentities($_POST['email']) . "\">".htmlentities($_POST['email']) . "</a></p>"; 
于 2012-11-09T11:13:39.987 回答
0
echo "I'm calling you at " .$_POST['telephone']. " or email you at <a href=\"mailto:{$_POST['email']}\">{$_POST['email']}</a>";
于 2012-11-09T11:07:49.637 回答
0

邮递员?

并不是说我喜欢它(你会发现很难找到喜欢的人)......

echo "I'm calling you at " .$_POST['telephone']. " or email you at <a href='mailto:".$_POST['email']."'>".$_POST['email']."</a>";
于 2012-11-09T11:07:53.443 回答
0

使用这个:

    echo "I'm calling you at " .$_POST['telephone']. " or email you at 
    <a href=\"mailto:".$_POST['email'].">" $_POST['email']."</a>";
于 2012-11-09T11:08:01.263 回答