How do I get user-inputted information from the website directly to my e-mail?


Tags: javascript,php,html,css,real-time-updates

Problem :

So I've decided to make a website a few months ago and have then picked up basic HTML, CSS, Javascript and Jquery. Now I want to do two things with my website,

  1. show a user-voted poll somewhere on my website that will update live as the users vote on different optinos.
  2. A form on my website that when the user fill out and click the "submit" button, the form will automatically be forwarded to my desired e-mail address

I've been told to learn PHP because it's suppose to help my problem, but so far I have yet to see how it's going to help me solve the above two problems. Any suggestion on how I can achieve the two things above??

PS: if someone can explain what exactly is PHP, I will also be really grateful. I've been looking up what PHP is and the majority of the responses I get is "it's a server side language", which is not exactly helpful. And if PHP does help me solve the two questions above, how?



Solution :

PHP is actually a "server side language" (mostly) :)

It means that it allows your web server to be smart, i.e:

  • load/read data from a database
  • send emails
  • generate pages dynamically (instead of just serving static pages)
  • etc...

Sending mail with PHP is documented here: http://us2.php.net/manual/en/function.mail.php

Basically in your HTML you'll tell your form to be posted to a specific PHP script which is hosted on your web server, e.g:

<form action='send_mail.php'>.....</form>

And this script will retrieve the form data and handle the mail sending, e.g:

<php>
    $data = $_POST; // contains the form's input values
    mail("foo@mail.com", "Notification mail", "A form has been submitted with some data: ".$data["fieldName"]);
</php>

    CSS Howto..

    In CSS how do I affect links of only 1 class

    How to extend Navigation in CSS

    How can I add a custom HTML map marker to a Nokia HERE map?

    How to return dynamic CSS with ASP.NET MVC?

    Create template page for showing jpg's from direct links [closed]

    How to use css style in php

    How much time should I put into validating my HTML and CSS?

    How to call single dropdown to every element using jquery

    How to make a jsp page keyboard accessible and how to change the position of a popped up jsp page?

    How to refer to an image with a certain id thats into a section with a certain id - CSS

    How to make a footer stay on the bottom?

    How to collapse div same like facebook chat

    CSS float: how to form the second row based on tallest DIV?

    How to make menu to slide right on click using HTML and CSS?

    SVG, how to evaluate the property of the svg object

    How to use HTML/CSS to show images and titles inline?

    how to make a css “if opera,not…”

    how to put css max-left or min-left position to absolute object?

    How to conditionally add css class in view in web2py?

    How to use image tag in body of html instead of loading image from css?

    How should I modify this code so it works with severel id's?

    How to reposition CSS-hover popups to stay within a fixed frame?

    In Firebug, how to tell what is overriding a style?

    How to write a structured HTML/CSS?

    How to minified all js and css files using gruntfile.js in sails.js

    Adding some automatic versioning to CSS files. How come I'm not able to pull assembly info?

    HTML5 vs HTML4 - h1 tag rendered with extra space - how to remove?

    how to change the colour property of tag used for a text

    Using CSS to show/hide content. How do I make hide the default

    How to vertically align text inside
  • in a CSS based drop-down menu?