Hi
I am trying to get the code below working. It is to allow someone from mysite email an article to a friend. I cannot seem to get it work. Can anyone offer any guidance.
<a href=\"emailarticle.php?aID=$aID\"><img src=../images/friend.gif border=0 Alt=\"Email Article Page\"></a>";
This above code is where they click on the link to email the article.
<?php
$connection = mysql_connect("xxx","xxx","xxx")
or die ("Couldn't connect to server.");
$db = mysql_select_db("articles", $connection) or die ("Unable to select database.");
if (isset($aID)) {
echo"
////EMAIL FORM/////
// let them specify address to send to..
<form action=emailarticle.php method=POST>
sender <input type=Text name=articlesender>
senderemail<input type=Text name=senderemail>
send to<input type=Text name=sendtoemail>
<input type=submit value=send>
</form>";
//IF THE FORM IS SUBMITTED
// AND THE USER HAS SPECIFIED WHO
// TO SEND AN EMAIL TO,
// AND THE ID is PRESENT (know which article
//to email) etc
if ($submit) {
$sql = "SELECT * from articles where aID=$aID";
//echo "$sql";
$sql_result = mysql_query($sql) or die("Couldn't execute query.");
while ( $row = mysql_fetch_array($sql_result ) ) {
// GET ANY INFO YOU MIGHT NEED TO EMAIL
$articletitle = $row["title"];
$articletext = $row["content"];
}
//create the email subject
// the article sender would be specified in the form
$emailsubject = "$articlesender has sent you an article";
$emailbody = " Hello Your friend ($senderemail) thought you might find the following article interesting: $articletext";
//(You can put promotional stuff in this email etc)
//REMEMBER, tHE $sendtoemail would have been
//specified on the form submitted
mail
($sendtoemail,$emailsubject,$emailbody,'FROM: '.$senderemail);
echo("
Success!
The article has been sent to $sendtoemail successfully");
}
} else {
echo("You did not specify an article to send");
}
?>
When i hit the send button , i get the message "You did not specify an article to send"
What am i missing ?
Thanks