For a page with multiple forms here is one way of processing the different POST values that you may receive. This code is good for when you have distinct forms on a page. Adding another form only requires an extra entry in the array and switch statements.
<?php
if (!empty($_POST))
{
$postNameArr = array('F1_Submit', 'F2_Submit', 'F3_Submit');
$postIdentifierArr = array();
foreach ($postNameArr as $postName)
{
if (array_key_exists($postName, $_POST))
{
$postIdentifierArr[] = $postName;
}
}
if (count($postIdentifierArr) != 1)
{
count($postIdentifierArr) < 1 or
die("\$_POST contained more than one post identifier: " .
implode(" ", $postIdentifierArr));
die("\$_POST did not contain a known post identifier.");
}
switch ($postIdentifierArr[0])
{
case 'F1_Submit':
echo "Perform actual code for F1_Submit.";
break;
case 'Modify':
echo "Perform actual code for F2_Submit.";
break;
case 'Delete':
echo "Perform actual code for F3_Submit.";
break;
}
}
else {
echo "Perform code for page without POST data. ";
}
?>