Reply to Re: form for sending email with an option in select function

Your name:

Reply:


Posted by Janwillem Borleffs on 11/26/05 00:50

mo wrote:
> I'd like to use this form to send a seperate email message to (depend
> on the city, which has a different email address) NY and LA...
> how to do this in php?
>

First, you get rid of the mailto form action by replacing it with the
following:

<form action="<?php print $_SERVER['PHP_SELF'] ?>" method="post">

And then, you prepend a script like the following (that is, *before* the
HTML):

<?php
$sender = 'You <you@yourdomain.com>';
$recepients = array(
'wybierz' => 'emaila@mail.com',
'ny' => 'emailb@mail.com',
'la' => 'emailc@mail.com'
);

if (isset($_POST['wyboor']) && isset($recepients[$_POST['wyboor'])) {
$recepient = $recepients[$_POST['wyboor']];
$username = $_POST['username'];
$subject = "A mail from $username";
$msg = 'A message from $username";

if (mail($recepient, $subject, $msg, "From: $sender")) {
print "Message from $username sent to $recepient";
}
}
?>


JW

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация