Old 03-21-2006   #1 (permalink)
High Priest
 
sizzla's Avatar
 
Join Date: Feb 2006
Location: ...downloading
Posts: 42

Talking .:PHP Form in biorust

I would like to refer to the PHP form tut under the Tutorials section of biorust. I tried the code and it works fine. However I would like to know if its possible to send e-mails to more than one e-mail address (using the same code) and also how to code a drop-down list using PHP. Thanks a bunch for this great site !!!

__________________
sizzla is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 03-21-2006   #2 (permalink)
Registered User
 
Join Date: Apr 2005
Location: antwerp, belgium
Posts: 51

Quote:
Originally Posted by sizzla
I would like to refer to the PHP form tut under the Tutorials section of biorust. I tried the code and it works fine. However I would like to know if its possible to send e-mails to more than one e-mail address (using the same code) and also how to code a drop-down list using PHP. Thanks a bunch for this great site !!!

euh I'd say you can just make a second $to variabel and make it send the file there in a second instance

so something like

PHP Code:
if(!strstr($email "@"))
{

echo 
'Please enter a valid email address. ';
echo 
'<a href="javascript:history.back(1)">Try again</a>';

} else {

$send mail($to "Contact message from YourWebsite" "This email was sent from your website.\n\n".$name." send this message from ".$email.":\n\n".$message."\n\nClick reply and it will send to this email." "From: Contact Form Reply-to: ".$email);

$send2 mail($to2 "Contact message from YourWebsite" "This email was sent from your website.\n\n".$name." send this message from ".$email.":\n\n".$message."\n\nClick reply and it will send to this email." "From: Contact Form Reply-to: ".$email);

if(
$send || $send2)
{

echo 
'Mail sent successfully.';

} else {

echo 
'There was an error sending the mail!';

}

do mind that the error message would be send if one of the two or both are not delivered
__________________
sneeuwbal is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 03-21-2006   #3 (permalink)
Registered User
 
MrProtoman's Avatar
 
Join Date: Aug 2004
Location: Evansville, IN
Posts: 70

Send a message via ICQ to MrProtoman Send a message via AIM to MrProtoman Send a message via MSN to MrProtoman Send a message via Yahoo to MrProtoman
Post

Actually, it'd be easier to just add multiple recipients instead of multiple sends. Just replace $to with the code below. If you want to add a third person, just copy everything from the ' after name@example.com to the last semi-colon and paste it where the last semi-colon is.
PHP Code:
// multiple recipients
$to  'name@example.com' ', '// note the comma
$to .= 'user@example.com'
The drop down is another story. If you want to just pick from a list of single email addresses, do this.
PHP Code:
$to trim($_POST['to']); 
HTML Code:
<tr valign="top">
<td>Select Recipient</td>
<td><select name="to">
<option name="to" value="user@example.com">User</option>
<option name="to" value="name@example.com">Name</option>
<option name="to" value="person@example.com">Person</option>
</select></td>
</tr><tr valign="top">
<td>Your email address </td>
<td><input name="email" type="text" size="32"></td>
</tr>
And then comes the fun one. If you want to send to multiple people in multiple groups.
PHP Code:
if ($formto == 'admin') {
$to  'admin@example.com' ', ';
$to .= 'webmaster@example.com';
}
if (
$formto == 'mods') {
$to  'moderator@example.com' ', ';
$to .= 'leader@example.com';

HTML Code:
<tr valign="top">
<td>Select Recipient</td>
<td><select name="formto">
<option name="formto" value="admin">User</option>
<option name="formto" value="mods">Name</option>
</select></td>
</tr><tr valign="top">
<td>Your email address </td>
<td><input name="email" type="text" size="32"></td>
</tr>
For each group that you want to send to, make an option for them in the form itself, and an if statement in the php. I think PHP variables are case sensitive (can't rememeber, I keep them the same anyway), so if you put admin in one, put admin in the other, not ADMIN or something.

As a bit of a warning, I put this all together from the available tutorial, info from the Zend website on mail(), and some of my old contact scripts and experience. I haven't tested it yet, but I'll moniter this thread if there's any problems.
__________________
MrProtoman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 03-22-2006   #4 (permalink)
High Priest
 
sizzla's Avatar
 
Join Date: Feb 2006
Location: ...downloading
Posts: 42

Thanx, i will try it out and get back to you.

On another note, can the same contact form with multiple recipients and a drop down list be created in ASP? It is good to know both options coz you never know what your clients would prefer.
__________________
sizzla is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 03-22-2006   #5 (permalink)
Registered User
 
MrProtoman's Avatar
 
Join Date: Aug 2004
Location: Evansville, IN
Posts: 70

Send a message via ICQ to MrProtoman Send a message via AIM to MrProtoman Send a message via MSN to MrProtoman Send a message via Yahoo to MrProtoman
I would assume so, though from what Google is telling me, you have to have some kind of extra function/plugin added in to send an email, whereas PHP's mail() is pretty well standard. The drop down is actually HTML, so as long as the language you're using supports retrieving information from an HTML form, you're good.
__________________
MrProtoman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 03-23-2006   #6 (permalink)
High Priest
 
sizzla's Avatar
 
Join Date: Feb 2006
Location: ...downloading
Posts: 42

Thanx protoman. BTW i recently downloaded a free web design software PHP DESIGNER 2006. I have beeen using Dreamweaver 8 but since i configured the php, html and CSS manuals plus XAMPP i have really started appreciating the power of PHP...
__________________
sizzla is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 03-23-2006   #7 (permalink)
Registered User
 
MrProtoman's Avatar
 
Join Date: Aug 2004
Location: Evansville, IN
Posts: 70

Send a message via ICQ to MrProtoman Send a message via AIM to MrProtoman Send a message via MSN to MrProtoman Send a message via Yahoo to MrProtoman
http://notepad-plus.sourceforge.net/

I'd say plain Notepad, but I like the syntax highlighting and format changes so I know I've got my quotes and brackets closed. Causes less stress down the road when I can't figure out why something is messing up because I don't realise I left out a ". :P
__________________
MrProtoman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Official Biorust Quote Thread! BlodoPKNZ General Discussions 6 09-14-2004 09:18 PM
Biorust Logo Competition Winner! Man1c M0g Announcements 16 07-29-2004 03:43 AM
Biorust Vector Logo Design Competition Man1c M0g Showrooms & Works In Progress 35 07-24-2004 05:04 PM
The #biorust IRC Channel! Man1c M0g Announcements 10 02-03-2004 03:58 PM
Biorust v3 Man1c M0g BioRUST Specific Threads 15 11-02-2003 03:37 AM


All times are GMT +1. The time now is 05:54 PM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT