0

Using this example, Add php variable inside echo statement as href link address?,

I am able to grab an email address from my SQL DB and make it clickable in my form. The HTML looks like this:

Contact: blahblah@gmail.com

but when I either hover over if or click it, it adds the name of my domain before it. So clicking the above tries to go to:

http://mydomainname.com/blahblah@gmail.com

Here is some of the code that generates my link

            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();
            }   

I am guessing it shouldn't be a 'a href' but not sure what it should be.

user3105748
  • 123
  • 7

1 Answers1

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>
StudioTime
  • 22,603
  • 38
  • 120
  • 207