Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link in PHP If/Else Statement

Status
Not open for further replies.

VeronicaCBurgess

Technical User
Apr 25, 2003
27
US
I have the following php code that works but I would like to have the Email address have the link that opens up email. Hope I am clear enough.

Code:
<?php if($row_Contacts['PublishEmail']==0){
  echo 'You can reach this member via the <a href="interior/contact.html">Contact page</a>';
  } else {
  echo $row_Contacts['Email'];
  }
  ?>

I have tried everything but always get error.

Thanks
 
Code:
<?php if($row_Contacts['PublishEmail']==0){
  echo 'You can reach this member via the <a href="interior/contact.html">Contact page</a>';
  } else {
   $contact_email = $row_Contacts['Email'];
  echo '<a href="mailto:'.$contact_email.'">'.$contact_email.'</a>';
  }
  ?>

Just click the link and your e-mail program pops-up!
Use mailto: in <a> tags to open the e-mail program.

You can use "mailto:email@dot.com?subject=subject_here&body=message_body_here" if you want subject and body (or any) to be filled automaticaly

jamesp0tter,
mr.jamespotter@gmail.com

p.s.: sorry for my (sometimes) bad english :p
 
If you can, make a script that uses the mail() function!
The example above, is client dependent!

If you do not wish to use mail(), you can also make php/mysql system, where as you store other enqueries from members and can choose to show them in FAQ.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top