Stevan Posted June 4, 2005 Share Posted June 4, 2005 I made a form in dreamweaver to send a invoice my customers How to I make a script to send it it them I know how to me BUT that adress is in the background I wanted to be able to put there email adress in a box and push send THXS Steve Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/ Share on other sites More sharing options...
LexNaturalis Posted June 5, 2005 Share Posted June 5, 2005 [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] $to = $_POST[\'email\'];[/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Then just call the mail() function to send the mail to the address that's entered in the form. This assumes the text box is called "email", but you could call it whatever you want. Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7690 Share on other sites More sharing options...
Stevan Posted June 5, 2005 Author Share Posted June 5, 2005 I am not sure what you mean I tryed to paste what you said into th eform and it just shows up on the page am i doing something wrong ?? I am very new at this Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7692 Share on other sites More sharing options...
obsidian Posted June 5, 2005 Share Posted June 5, 2005 I am not sure what you mean I tryed to paste what you said into th eform and it just shows up on the page am i doing something wrong ?? I am very new at this 239990[/snapback] like lexnaturalis said, you've got to use the mail() function to get the mail to send. he was simply showing you how to pull the address to use in the mail function. click on the function above to view the php manual page corresponding to this great function. good luck! Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7693 Share on other sites More sharing options...
Stevan Posted June 5, 2005 Author Share Posted June 5, 2005 Way too complaited for me to understand Is there any other way to do it? Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7694 Share on other sites More sharing options...
obsidian Posted June 5, 2005 Share Posted June 5, 2005 Way too complaited for me to understand Is there any other way to do it? 239998[/snapback] that's going to be the easiest way... let me see if i can break it down for you: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<?php $to [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\'you@yourdomain.com\'[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#FF8000\"]// the recipient of the email [/span][span style=\"color:#0000BB\"]$subject [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\'Some Subject\'[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#FF8000\"]// whatever you want to appear in the subject line [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]= \'[/span][span style=\"color:#0000BB\"]Text for message goes here.\"; // message text mail($to, $subject, $message); ?> [/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] that's all there is to it! you have lots of additional "optional" settings that you don't need to worry about at this stage, but to get it to work, all you have to do is provide a To: address, subject, and message. hope this helps some. good luck! Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7695 Share on other sites More sharing options...
Stevan Posted June 5, 2005 Author Share Posted June 5, 2005 Ok i made a form box on the page and cut and pasted it into that That is not right as it shows the coding only Do i have to do something else or a php page or ?? Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7696 Share on other sites More sharing options...
obsidian Posted June 5, 2005 Share Posted June 5, 2005 Ok i made a form box on the page and cut and pasted it into that That is not right as it shows the coding only Do i have to do something else or a php page or ?? 240003[/snapback] ok, here is the full code for a basic contact form page: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]if (isset([/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'submit\'[/span][span style=\"color:#007700\"]])) { [/span][span style=\"color:#0000BB\"]$to [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\'you@yourdomain.com\'[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#FF8000\"]// replace your address here [/span][span style=\"color:#0000BB\"]$subject [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'subject\'[/span][span style=\"color:#007700\"]]; [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'message\'[/span][span style=\"color:#007700\"]]; if ([/span][span style=\"color:#0000BB\"]mail[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$to[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$subject[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$message[/span][span style=\"color:#007700\"])) { [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"Mail sent!\"[/span][span style=\"color:#007700\"]; } else { [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"Couldn\'t send mail!\"[/span][span style=\"color:#007700\"]; } } echo (isset([/span][span style=\"color:#0000BB\"]$message[/span][span style=\"color:#007700\"])) ? [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]: [/span][span style=\"color:#DD0000\"]\'\'[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]?> [/span] <form name=\'email\' method=\'post\' action=\'\'> Subject: <input type=\'text\' name=\'subject\' /><br /> Message: <br /> <textarea name=\'message\' cols=\'60\' rows=\'20\'></textarea><br /> <input type=\'submit\' name=\'submit\' value=\'Send It\' /> </form> [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] this saved with a ".php" extension should allow you to send basic emails through the form. hope this helps! Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7698 Share on other sites More sharing options...
Stevan Posted June 5, 2005 Author Share Posted June 5, 2005 Ok I did not save it as php so that solves that probelm. The only problem i see is that you have it going to me I need it so i can enter there eamil adreess and send to them THXS Steve Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7699 Share on other sites More sharing options...
obsidian Posted June 5, 2005 Share Posted June 5, 2005 sounds like you've got it! good luck! Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7700 Share on other sites More sharing options...
Stevan Posted June 5, 2005 Author Share Posted June 5, 2005 Please How do I change it to send to them I want to send the form to there email adress STEVE Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7701 Share on other sites More sharing options...
obsidian Posted June 5, 2005 Share Posted June 5, 2005 Please How do I change it to send to them I want to send the form to there email adress STEVE 240011[/snapback] just include a text field to enter their email address into (named 'email' or something like that), then do the following: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#FF8000\"]// change this line: [/span][span style=\"color:#0000BB\"]$to [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\'you@yourdomain.com\'[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#FF8000\"]// to: [/span][span style=\"color:#0000BB\"]$to [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'email\'[/span][span style=\"color:#007700\"]]; [/span][span style=\"color:#0000BB\"]?> [/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] that's it. Quote Link to comment https://forums.phpfreaks.com/topic/2347-send-mail/#findComment-7702 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.