There are two types of request: GET or POST. GET requests would be where you have variables in the URL. There's one here in this thread right now:
showthread.php?p=10952423#post10952423
That's setting the variable 'p' to 10952423
Now you can get hold of this variable in your PHP like this:
if (isset($_GET['p'])
$p = $_GET['p'];
else
$p = 0;
When you submit a form you set the type of request it's making:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="test.php">
And as you can see, you've set the method here to be 'post'.
This means that when your user clicks one of your buttons:
<td colspan="2"><input type="submit" name="button" id="button" value="Submit" />
<input type="submit" name="button2" id="button2" value="Submit" /></td>
You'll get a the value associated with the button in the $_POST array with the name of the element in that array named the same as the 'name' value on the HTML input, like so:
if (isset($_POST['button'])
$button1 = $_GET['button']; // Will actually be 'Submit'
else
$button1 = "not pressed";
if (isset($_POST['button2'])
$button2 = $_GET['button2']; // Will also be 'Submit'
else
$button2 = "not pressed";
The error in your syntax is to give each button the same value but different names. Presumably right now you will be seeing two buttons, both with 'Submit' written on them.
Instead give each button the same name but a different value:
<td colspan="2"><input type="submit" name="submit_button" id="button" value="Choice 1" />
<input type="submit" name="submit_button" id="button2" value="Choice 2" /></td>
and then your PHP will be more like:
if (isset($_POST['submit_button'])
$button = $_GET['submit_button']; // Will be 'Choice 1' or 'Choice 2' depending on what they pressed
else
$button = "No Choice";
// Note that you'll also have:
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];