Re: get the $email string

From: Date: Thu, 16 Jan 2003 20:25:15 +0000
Subject: Re: get the $email string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131929@lists.php.net to get a copy of this message
At 5:04 PM +0000 1/16/03, Miguel Br·s wrote:
Hi, i made a page to display some user details and then clicking on the user name it goes to another page to send a mail via mail() function. here is the line of the first page <td width="20%" align="center"><b><font face="Arial" size="1" color="#808080"><a href="mail_active.php?email=$email"><? echo $row->name; ?></a></font></b></td> when click on user name, it goes to the mail_active.php?email=xxx@xxx.com on the mail_active.php page, how do I get the e-mail address to send? I mean, the mail function is mail ("$to","$subject","$message","From: $sender"); How can I take the $to string to be xxx@xxx.com?
IN this case you could use mail ($_GET['email'],"$subject","$message","From:$sender"); or mail ($_REQUEST['email'],"$subject","$message","From:$sender"); See http://www.php.net/manual/en/language.variables.external.php for more information on variable handling. Also keep in mind that the script as you've shown it is looks very insecure; anybody, including joe-spammer, could send mails to people simply by calling your URL http://your.domain/mail_active.php?email=random_person@zzz.com It's best to pass some sort of obscure ID instead of the data. I would check out the use of sessions here: http://www.php.net/manual/en/ref.session.php -steve -- +------------------------------------------------------------------------+ | Steve Edberg sbedberg@ucdavis.edu | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +------------------------------------------------------------------------+ | SETI@Home: 1001 Work units on 23 oct 2002 | | 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens... | +------------------------------------------------------------------------+

« previous php.general (#131929) next »