Web Hosting, Design, & Coding forum

General discussion

I kindly need a "mail.php" for the form below.

by petes7 / March 21, 2015 8:58 PM PDT

Hello there, its a pleasure to have this chance of communicating to you once again. Happy new year to everyone! I have designed a website for a client and I am finding it difficult to have my contact us form to submit my information to my email address in the "mail.php". I need your urgent help please! below is the form.

Kindly write for me the "mail.php" for the form below. Thank you

<div class="span6">
<div class="pad_right20">
<h2>Contact Form</h2>

<div id="note"></div>

<div id="fields">
<form id="ajax-contact-form" class="form-horizontal" action="javascript:alert('success!');">


<div class="control-group">
<label class="control-label" for="inputName">Your full name:</label>
<div class="controls">
<input class="" type="text" id="inputName" name="name" value="Your full name:" onBlur="if(this.value=='') this.value='Your full name:'" onFocus="if(this.value =='Your full name:' ) this.value=''">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Your email:</label>
<div class="controls">
<input class="" type="text" id="inputEmail" name="email" value="Your email:" onBlur="if(this.value=='') this.value='Your email:'" onFocus="if(this.value =='Your email:' ) this.value=''">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPhone">Phone number:</label>
<div class="controls">
<input class="" type="text" id="inputPhone" name="phone" value="Phone number:" onBlur="if(this.value=='') this.value='Phone number:'" onFocus="if(this.value =='Phone number:' ) this.value=''">
</div>
</div>


<div class="control-group">
<label class="control-label" for="inputMessage">Message:</label>
<div class="controls">
<textarea class="" id="inputMessage" name="content" onBlur="if(this.value=='') this.value='Message:'"
onFocus="if(this.value =='Message:' ) this.value=''">Message:</textarea
</div>
</div>


<button type="submit" class="submit"><em></em>Submit</button>     <button type="reset" class="submit"><em></em>Reset</button>
</form>
</div>

Thanks in advance and hope to hear from you so soon.

Discussion is locked
You are posting a reply to: I kindly need a "mail.php" for the form below.
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: I kindly need a "mail.php" for the form below.
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Re: mail
by Kees_B Forum moderator / March 21, 2015 9:43 PM PDT

The problem with mail is that most people with click this on a device that has no standard mail app and api. For example, they only use gmail.com in a browser or use some of the many mail apps on their smartphone or tablet.

So good alternative is to write the information entered on the form to a table in the database that's linked to your application. A combination of PHP and MySQL is quite common for that, as you - as a PHP programmer - surely know.

The alternative is to implement the mail on your server background coding (where you do have a supported e-mail engine).PHP runs on the server, not on the client, so that mail functionality should run on your server also. http://www.w3schools.com/php/func_mail_mail.asp tells more.

Doing it in the client is old-fashioned and impractical.

Kees

Kees

Collapse -
Your form's action
by Sovereign Forum moderator / April 13, 2015 12:39 AM PDT

should probably POST the data to a file called "mail.php". In it, you can obtain all the data via the global $_POST. You can then use the function Kees provided to actually send the message.

Now, I would recommend using a mail provider, since there can be issues with the delivery of messages if you're not using an authenticated mail server. One such provider is SendGrid, but there are others.

All that said, it is wise to record a copy of the message being sent in a database, just in case the mail is lost or you would like to perform a query on all the messages delivered.

~Sovereign

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

CNET FORUMS TOP DISCUSSION

Help, my PC with Windows 10 won't shut down properly

Since upgrading to Windows 10 my computer won't shut down properly. I use the menu button shutdown and the screen goes blank, but the system does not fully shut down. The only way to get it to shut down is to hold the physical power button down till it shuts down. Any suggestions?