I have one page that has several form actions:

form action="maze_enter.php" method="post" enctype="application/x-www-form-urlencoded" name="finance" target="_self">
      <tr>
        <td colspan="2" align="center" valign="middle"><span class="style11"><a href="#" onclick="document.finance.submit();return false;">Enter Maze</a> </span></td>
      </tr>
	</form>

<form action="maze_enter.php" method="post" enctype="application/x-www-form-urlencoded" name="shop" target="_self">
      <tr>
        <td colspan="2" align="center" valign="middle"><span class="style11"><a href="#" onclick="document.shop.submit();return false;">Enter Maze</a> </span></td>
      </tr>
	</form>

I want to target the same page "maze_enter.php" and have a branching if statement that deals with the various selected action:

<?

if($_POST['submit'] == 'auto') {
   echo "auto";
 }
 else if($_POST['submit'] == 'finance') {
   echo "finance";
 }
  else if($_POST['submit'] == 'groups') {
   echo "groups";
 }
  else if($_POST['submit'] == 'movies') {
   echo "movies";
 }
  else if($_POST['submit'] == 'music') {
   echo "music";
 }
  else if($_POST['submit'] == 'pers') {
   echo "pers";
 }
  else if($_POST['submit'] == 'real_est') {
   echo "real_est";
 }
  else if($_POST['submit'] == 'shop') {
   echo "shop";
 }
  else if($_POST['submit'] == 'sports') {
   echo "sports";
 }
  else if($_POST['submit'] == 'tech') {
   echo "tech";
 }
  else if($_POST['submit'] == 'travel') {
   echo "travel";
 }
  else if($_POST['submit'] == 'tv') {
   echo "tv";
 }
 else {
   echo "Nothing!";
 }

?>

For some reason, this is not working correct. It produces "Nothing!", Probably something simple.

Appreciate the help.

this line should call the form like so

<td colspan="2" align="center" valign="middle"><span class="style11"><a href="#" onclick="document.forms[0].submit();">Enter Maze</a> </span></td>
This article has been dead for over six months. Start a new discussion instead.