Page 1 of 2

lixas please help

Posted: Sun Apr 16, 2006 6:35 am
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.

Posted: Mon Apr 17, 2006 2:59 am
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

Posted: Mon Apr 17, 2006 8:01 am
by jasondsouza
thank you

Posted: Fri Apr 28, 2006 3:22 pm
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

Posted: Sat Apr 29, 2006 10:13 am
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"];

Posted: Sat Apr 29, 2006 6:13 pm
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

Posted: Sat Apr 29, 2006 8:25 pm
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

Posted: Mon May 01, 2006 11:56 am
by jasondsouza
My php code is displayed on submit
what should i do.

Posted: Mon May 01, 2006 1:27 pm
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 :)

Posted: Mon May 01, 2006 4:57 pm
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);