473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

How to send form data to email id by using PHP

Hi,

We are using the yahoowebHostiing service for my company website, In
that one screen of the SendComments/FeedBack section is there, I'm
basically dot.net develeoper ,but yahoowebhosting not
support .asp,.aspx files, it supports PHP files,

I'm searching in JavaScript ,but not found any matter,
I'don't Know PHP.I'm having lot of pressure of higer officials.Please
help me on this.
Please give the Details of the PHP to send form data to given mail id
Name,email,phoneNo, Commnets...........thease are the fileds and by
click send it would be come to given to address mail id,
and how to run the php code, Please send the PHPCODE and Procee,I will
put it on the server

thanks

Jun 22 '07 #1
2 5609
Malli mindwave wrote:
Hi,
Hi,

Welcome here from comp.lang.javascript.

We are using the yahoowebHostiing service for my company website, In
that one screen of the SendComments/FeedBack section is there, I'm
basically dot.net develeoper ,but yahoowebhosting not
support .asp,.aspx files, it supports PHP files,
Wise choice. But not very nice for you.
>
I'm searching in JavaScript ,but not found any matter,
I'don't Know PHP.I'm having lot of pressure of higer officials.Please
help me on this.
Higher officials seldom care about 'details' like learning a new language
from scratch. Why should they? They don't have to implement it themselfs..
;-)
Please give the Details of the PHP to send form data to given mail id
Name,email,phoneNo, Commnets...........thease are the fileds and by
click send it would be come to given to address mail id,
and how to run the php code, Please send the PHPCODE and Procee,I will
put it on the server
Nobody can send you complete code. Too many unknown variables.

But a good place to start:
www.php.net then type mail into the searchbox.

Also look at the mailfunction itself:
http://nl2.php.net/manual/en/function.mail.php

Browse around a little and try to implement some code yourself on your
server.
The usercontributed notes contain a lot of usefull information.

Basicly what you do is this (But PLEASE don't do it like this because all
kind of ugly hackers will use your site to send spam. This is called
header-injection. You don't want that.):

1) Receive the forminformation
2) assemble the email (body, subject, to who? etc)
3) send the email

Suppose your html page has a form with the following elements:
- email
- name
- phonenr
- comments

And when the user clicks submit, you want that those 4 elements are send to
'm************@mindwave.com'

<?php
// receive the posted formelements, I made up the names myself.
$email = $_POST["email"];
$name = $_POST["name"];
$phonenr = $_POST["phonenr"];
$comments = $_POST["comment"];

// Please note that this input MUST be sanitised before using
// but for the sake of a simple example I don't.

$subject = "Somebody filled in a form";
$sendto = 'm************@mindwave.com';
$body = "Hi Malli,\nSomebody filled in a form.\n\n";
$body .= "Passed info:\n";
$body .= "email: $email\n";
$body .= "name: $name\n";
$body .= "phonenr: $phonenr\n";
$body .= "comments: $comments\n";

// Wordwrap the body to max 70 characters a line:
$body = wordwrap($body, 70);

mail($sendto, $subject, $body);

// done

?>

That is basically all.
But be warned, even veteran PHP programmers make mistakes with emailing,
simply because a lot can go wrong.
Like the abovementioned header-injection.
Or wrong headers set according to spamfilters, so your email never arives.
(try sending to hotmail.com if you need a headache)

You might want to use a lib/class to send email.

I use HTMLMimeMail a lot, for sending emails that have both text and HTML
content and/or attachments. (google for it if you want it)

PHP also have the PEAR packages that contain a good mail class.
Very good chances they are allready installed on your system.

Honest warning:
This might be over your head if you don't even know PHP. :-/
If you are on a tight deadline, you might consider hiring a PHP programmer
who did this before to help you out. Setting up a basic emailprogram
shouldn't take more than a day.

Good luck.

Regards,
Erwin Moller

>
thanks
Jun 22 '07 #2
Malli mindwave wrote:
Hi,

We are using the yahoowebHostiing service for my company website, In
that one screen of the SendComments/FeedBack section is there, I'm
basically dot.net develeoper ,but yahoowebhosting not
support .asp,.aspx files, it supports PHP files,

I'm searching in JavaScript ,but not found any matter,
I'don't Know PHP.I'm having lot of pressure of higer officials.Please
help me on this.
Please give the Details of the PHP to send form data to given mail id
Name,email,phoneNo, Commnets...........thease are the fileds and by
click send it would be come to given to address mail id,
and how to run the php code, Please send the PHPCODE and Procee,I will
put it on the server

thanks
Try googling for PHP and formmail. There are a number of scripts out there.
Jun 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kenny | last post by:
I'm trying to retrieve the data off a form (survey.htm) and email the results back to me using CDO and ASP (survey.asp). I'm confused as to how to retrieve the form data from survey.htm and send...
2
by: Fatih BOY | last post by:
Hi, I want to send a report from a windows application to a web page like 'report.asp' Currently i can send it via post method with a context like local=En&Username=fatih&UserId=45&Firm=none...
4
by: riteshjain82 | last post by:
Hi, Please go through this: I am having a file (default.asp) on which i am taking many details from a user before mailing it to someone. I have also provided the user with a facility of...
0
by: Dave S | last post by:
I have a lot of forms on our web site that require the user to fill out information and submit it back to us. currently the information comes back as name value pair. The our employee's then has to...
3
by: YMPN | last post by:
Hi Everyone, I'm deen from Riyadh. Please do help me with some problem i have. I have this formview control setup to recieved inputs from user (textbox, dropdownlist, others). After...
1
by: steinwaygirl | last post by:
Hi all, I have been searching so hard for the answer to this, hopefully some of you all can help. I have created an HTML file with various forms - also included CSS and some javascript for...
1
by: Malli mindwave | last post by:
Hi, I want to send form data to given email id, I'm using mailto:ur@mail.com, but it doesn't working it dirsctly goes to localSystem A/C i.e outlook.. <form name="form1" method="post"...
1
by: deepaks85 | last post by:
Dear All, I want to send some data through a form with Multiple attachment in an HTML Format. I have tried it but it is not working for me. I am able to send data without attachment but with the...
1
by: toretto | last post by:
Hello, I have a script php that I use on my website to permit visitors to send me some email with some data, this is the html table code: <table width="730" border="0" cellpadding="0"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.