Ok, I'll take a stab at this. If you want to work with PHP, you will need to install and configure both PHP and a webserver on your machine. This article might get you started: PHP Manual: Installation on Windows systems
Once you have your environment setup, you can start working with webforms. Directly From the article: Processing form data with PHP:
For this example you will need to create two pages. On the first page
we will create a simple HTML form to collect some data. Here is an
example:
Test PageData Collection
Name: | |
Age: | |
This page will
send the Name and Age data to the page process.php. Now lets create process.php to use
the data from the HTML form we made:
print "Your name is ". $Name;
print "
";
print "You are ". $Age . " years old";
print "
"; $old = 25 + $Age;
print "In 25 years you will be " . $old . " years old";
?>
As you
may be aware, if you leave out the method="post" part of the form, the
URL with show the data. For example if your name is Bill Jones and you
are 35 years old, our process.php page will display as
http://yoursite.com/process.php?Name=Bill+Jones&Age=35 If you want,
you can manually change the URL in this way and the output will change
accordingly.
Additional JavaScript Example
This single file example takes the html from your question and ties the onSubmit event of the form to a JavaScript function that pulls the values of the 2 textboxes and displays them in an alert box.
Note: document.getElementById("fname").value gets the object with the ID tag that equals fname and then pulls it's value - which in this case is the text in the First Name textbox.
function ExampleJS(){
var jFirst = document.getElementById("fname").value;
var jLast = document.getElementById("lname").value;
alert("Your name is: " + jFirst + " " + jLast);
}
First name:
Last name: