Jump to content

mkmDesign

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.mkmdesign.co.uk

Profile Information

  • Gender
    Male
  • Location
    Edinburgh, Scotland

mkmDesign's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Cool, so all you need to do then is add you SQL query before setting your variables in the PHP file. So something like: <?php $sql = mysql_query("SELECT * FROM tablename"); $myrow = mysql_fetch_assoc($sql); $mail = $_POST['mail']; $name = $_POST['name']; $subject = $_POST['subject']; $text = $_POST['text']; $to = $myrow['email']; $message =" You received a mail from ".$mail; $message .=" Text of the message : ".$text; if(mail($to, $subject,$message)){ echo "mail successfully sent"; } else{ echo "Error mail not sent"; } ?>
  2. Have you given each entry in your table a unique key such as an ID? If so, just alter your SQL query to only select the second row: "SELECT * FROM QANDATable WHERE id = 2"; The above would work if your table had a column named id and the second row you are after was the 2nd record in the table.
  3. Hey Darnel, Correct me if I'm wrong but am I correct in saying all you are wishing to do is display a link that says 'Contact' that when clicked open up the users email client with a new email message to the email address supplied from the DB? If so, all you need to do is replace your code with the folowing (not tested): if(!empty($myrow['email'])){ echo "<a href=\"mailto: $myrow['email']\">Contact</a>"; } That should just display the word 'Contact' as a hyperlink that when clicked opens up the users email client. As the previous posters have stated, the other option would be to create a form that the user fills out and submits, then create a php script that forwards the data to an a specified email address. Straight forward enough to do, let me know if you need any help with that.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.