View Single Post
Old 03-04-2005, 08:35 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
yes, now that would completely work with a web form. do you need help to implement this? the logic would go something like this: ( haven't tested the code )
PHP Code:
<?
if($_POST['submit']){
  
$result mysql_query("select email from users where id=".$_POST['id']);
  if(
$row mysql_fetch_array($result)){
    
mail($row[0], $_POST['subject'], $_POST['message'], "From: ".$_POST['from']);
    echo 
"Email Sent";
  }else{
    echo 
"Email Failed";
  }
}else{
?>
<form method=post action=<?=$_SERVER['PHP_SELF']?>>
<input type=hidden name=id value=552>
From: <input type=text name=from><br>
Subject:<input type=text name=subject><br>
Message:<textarea name=message></textarea><br>
<input type=submit name=submit value=send>
</form>
<?
}
?>
__________________
Mike
sde is offline   Reply With Quote