如果是电子邮件,则将其命名为电子邮件链接!

A form sends name, topic, email, and blurb to MySQL db. Email is not a required field, but if it is !empty I want to include it as the name and echo the row data.

This is my idea so far:

if (!empty($_POST['email']))
{
    $row['name'] = "<A href='mailto:' . $_POST['email'] . '>' . $_POST['name'] . '</A>";
}
else
    {
        $row['name'] = $_POST['name'];
    }

I am having trouble sorting out the coding for the email/name any help please. And the rows will be:

while($row = mysql_fetch_array( $result )) {
    echo "<tr>";
        echo '<td><Posted by : ' . $row['name'] . ' on ' . $row['date'] . '<br />
        Topic : ' . $row['topic'] . '<br />Thoughts : ' . $row['thoughts'] . '</td>';
    echo "</tr>"; 

Not very well sorted yet, help please :-) thanks.

are you want that if the email is not empty then you want to replace it with name and echo it? if yes then try the below code..

if (!empty($_POST['email']))
{
    $row['name'] =$_POST['email'];

 $row['name']="<A href='mailto:' . $_POST['email'] . '>' . $_POST['name'] . '</A>";
}
else
    {
        $row['name'] = $_POST['name'];
    }