lixas please help

Any problem with PHP can be disscused here
jasondsouza
Posts: 348
Joined: Thu Jan 12, 2006 8:24 pm
Contact:

lixas please help

Post by jasondsouza »

lixas you being th best at php programming please help me to set up a web page which will help me to send mail from my web site.


--jasondsouza
ME working on a very new site. (Coming soon)
Come to my web Site
mohumben
Posts: 82
Joined: Thu Sep 15, 2005 9:45 pm

Post by mohumben »

Well, it's pretty simple. First, create an HTML page with forms, something like this:

Code: Select all

<form action="mail.php" method="POST">
Send To: <input type="text" name="to">

Subject: <input type="text" name="subject">

Message: 

<textarea rows="10" cols="30" name="message"></textarea>
</form>
Then, create the mail.php which actually receives the parameters and sends the mail:

Code: Select all

<?php

if (mail($_POST['to'], $_POST['subject'], $_POST['message'])) {
  echo 'Message Sent';
} else {
  echo 'Uh-oh, error!';
}

?>
This one is pretty simple, but will do the job. You can also add optional headers but this is another story

Hope this helps
jasondsouza
Posts: 348
Joined: Thu Jan 12, 2006 8:24 pm
Contact:

Post by jasondsouza »

thank you
--jasondsouza
ME working on a very new site. (Coming soon)
Come to my web Site
jasondsouza
Posts: 348
Joined: Thu Jan 12, 2006 8:24 pm
Contact:

Post by jasondsouza »

http://www.jocundabode.info/Order_form.htm

this page contains the fields. I want to send the contents of this form to my id and a copy to another email id but i don't want the customer to know the two email id's. Also I want to know what to put in the action atrribute of the form is it the name of the file like mail.php
--jasondsouza
ME working on a very new site. (Coming soon)
Come to my web Site
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

jasondsouza wrote: I want to send the contents of this form to my id and a copy to another email id but i don't want the customer to know the two email id's. Also I want to know what to put in the action atrribute of the form is it the name of the file like mail.php
Plz explain me, because i dont understand what you mean with that id or email id. Try to post some kind of understandable example
As i understud what you need i'll try to help you:
Action- it's a file name for submited form data
Mthod- You can use get or post If you will use get, in adress bar user will see:
filename.php?field_name1= its_value&field_name=Its_value_2.......
and so on. But if you use post, user will see just a filename.php so u should use POST In file source to get a value of some kind of you for field use code:
For POST method:

Code: Select all

if&#40]
For GET method: [code]if(isset($_GET["field_name1"]))
$field_name1=$_GET["field_name1"];
Image
jasondsouza
Posts: 348
Joined: Thu Jan 12, 2006 8:24 pm
Contact:

Post by jasondsouza »

suppose a user fills his details on the form that i have provided then all the data that he has keyed in should reach my email inbox once he has pressed the submit button. A copy of it should also be reaching my another email @another server

Eg. suppose the fields are name(lixas), email(me@a.com), address(new york, USA) and phone no(3242342) and the customer here lixas has keyed in his details (in the brackets) then pressed the submit button. then i should get a email like this

name lixas
address ny usa
email me@a.com
phone no:- 3242342

to jasondsouza@a.com
and copy of the above email to another email address ie suppose jasondsouza@b.com
--jasondsouza
ME working on a very new site. (Coming soon)
Come to my web Site
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

Code: Select all

<?php
$message="Field1= ".$_POST["field1"]."
Field2= ".$_POST["field2"]."
Field3=..............and so on"; 

if (mail("one@server.com", "form subbmision", $message) && mail("two@other_server.com", "form subbmision", $message))
{ echo 'Both messages Sent';}
else 
{  echo 'Uh-oh, error!'; }

?>
Hope this helps
Image
jasondsouza
Posts: 348
Joined: Thu Jan 12, 2006 8:24 pm
Contact:

Post by jasondsouza »

My php code is displayed on submit
what should i do.
--jasondsouza
ME working on a very new site. (Coming soon)
Come to my web Site
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

email me (lixas666[at]gmail[dot]com ) your source files or post you rources here. i dont know what are you doing wrong, i need to see sources :)
Image
mohumben
Posts: 82
Joined: Thu Sep 15, 2005 9:45 pm

Post by mohumben »

if you need, you can also use this:

Code: Select all

mail($_POST['email'] . ', [email]youremail@example.com[/email]', 'subject here', $contents_here, $headers_here);

Code: Select all

define('I_LOVE_PHP', true);
Post Reply