Reply to Re: Form selector

Your name:

Reply:


Posted by Martin Jay on 04/28/06 14:22

In message <4be9oiF10q7viU1@individual.net>, Paul Watt
<paulioNOSPAM@wattio.freeserve.co.uk> writes
>"Martin Jay" <martin@spam-free.org.uk> wrote in message
>news:izsUorC2veUEFwMM@spam-free.org.uk...
>> In message <4be1geF110r4pU1@individual.net>, Paul Watt
>> <paulioNOSPAM@wattio.freeserve.co.uk> writes
>>>I'm building a email form in a XHTML Strict page. I want to have a drop
>>>down
>>>selector box with 3 options in it (x,y,z for example). If x is selected I
>>>want x to be in the subject line of the email. How can I do this? Can it
>>>be
>>>done without Javascript?

>> Do you want to send the email using a mailto link, such as:
>>
>> <a href="mailto:martin@spam-free.org.uk?subject=Email subject"> ?
>>
>> Selecting the subject from a drop down menu without using a script isn't
>> possible.
>>
>> Another thing to bear in mind is that not everyone has a default email
>> client set up on the computer they're using, so this sort of link may
>> fail. :(

>I wasn't going to use a mailto link, proberbly a cgi or php processor

Okay, that's good.

So in your HTML you'll have something like the:

<select name="subject">
<option value="Subject 1" SELECTED>Subject 1</option>
<option value="Subject 2">Subject 2</option>
<option value="Subject 3">Subject 3</option>
</select>

Just POST that off to your PHP script and then use the mail command:

$subject = $_POST['subject'];

/* It's probably a good idea to include this so you don't end up with \'
and \" in the subject */

$subject = stripslashes($subject);

mail($to, $subject, $message);
--
Martin Jay

[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

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