I Have a mysql List with a link:
<a href="contactform.php?id=<?=$row['id']?>">Email Contact</a>
BUT I am stuck getting the [id], through the "contactform" to the "eprocess.php" form. (maybe I could do it thro the same form?)
Then I am also stuck on a few bits with the email! Here is some code what has been hashed together (so it is not valid yet! I need some guidance!).
<a href="contactform.php?id=<?=$row['id']?>">Email Contact links to this form:
//CONTACT FORM
<form name="eprocess" method="post" action="">
Your Email Address:<input name="emailer" type="text" value="your email"
Your Message to user:<textarea name="emailermessage" id="emailermessage"></textarea>
<label>Submit<input type="submit" name="Submit" value="Submit
<input name="Reset" type="reset" id="Reset" value="Reset">
Reset </label>
</form>
From there it goes to this "eprocess.php"
<?php
// EPROCESS FORM
// Check if the form was submitted
if(isset($_POST['submit'])){
// Get date/time
$date = date("y-m-d H:i:s");
// Get the subject from the form
$emaileradd = $_POST['emailer'];
$messageadd = $_POST['emailermessage'];
// Creating header information
$headers = "From: admin <wanted@somewhere.com>\n";
$headers .= "Bcc: admin <wanted@somewhere.com>\n";
$headers .= "Copy: $emaileradd \n"; // is this CORRECT?
// message to original user id
$messageid="
A member user is wanting further information on your wanted name
surname: ".$surname."
country: ".$country."
county: ".$county."
catergory: ".$catergory."
dates: ".$dates."
details: ".$details."
email: ".$email."
date: ".$date."
";
// message to user emailer
$messageuseradd="
Thankyou for contacting the user. A copy of the message for your records is listed below:
************************************************
Surname: ".$surname."
Country: ".$country."
County: ".$county."
Catergory: ".$catergory."
Dates: ".$dates."
Details: ".$details."
Your email: ".$email."
************************************************
";
// Retrieving the user“s data from the database
$query = mysql_query("SELECT * FROM wanted WHERE ID = '" . $_POST['id'] . "'");
while($row = mysql_fetch_array($query)){
// Making the user email address (to send to)
$to = $row['surname'] . " <" . $row['email'] . ">";
// Making the header 'Reply-To'
$headers .= "Reply-To: " . $row['surname'] . " <" . $row['email'] . ">n";
}
// Finishing the header
$headers .= "X-Mailer: PHP/" . phpversion();
// Send email - NEED TO ADD $messageuseradd and $messageadd
$mail = mail($to, $subjecta . ' - ' . $date, $messageadd, $headers);
$mail = mail($emailer, $subjectb . ' - ' . $date, $messageuseradd, $headers);
// Prints a message depending on the sent email status
$mail ? echo 'Email sent !' : echo 'Error sending email !';
}
?>
Any help tidying this up and getting [id] through to "eprocess".
Many thanks!