简体   繁体   中英

sending an email from HTML form, address in SQL

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM