I have 2 forms:
I have a list box with names on it and then 4 submit buttons that submit to the same page with several forms on the page. When I get to page 2 I check which submit button was clicked and go to that form on page2. The problem is that it is difficult to edit page 2 with the multiple forms.
I was thinking of submitting to different pages depending on which submit the user clicked. Can't find an understandable way to do this. This is how it is now.
Page 1
<!-- InstanceBeginEditable name="main" -->
<form action="sv_t2.php" method="post">
<table width="75%" border="0" cellpadding="0" cellspacing=".5">
<tr>
<th width="48%" scope="col"><div align="center"></div>
<div align="center"><font face="Arial, Helvetica, sans-serif" color="#003399">Please select<br>
an Institution </font></div></th>
<th width="27%" scope="col"><div align="center"></div></th>
<th width="25%" rowspan="12" valign="top" scope="col"> </th>
</tr>
<tr>
<th rowspan="10"><div align="center">
<select name="cboinst" size="10" class="listbox">
<?php
/
Create your SQL statement
/
$sql="Select par_no, inst_name from tbl_inst Order by inst_name;";
$result_set = pg_Exec ($conn, $sql);
$rows = pg_NumRows($result_set);
if ((!$result_set) || ($rows < 1)) {
//No connection or no rows returned, so print an error
echo "<H1>ERROR - no rows returned</H1><P>";
exit; //exit the script
}
for ($j=0; $j < $rows; $j++) {
echo "<option value=".pg_result($result_set, $j, "par_no")."> ".pg_result($result_set, $j, "inst_name")."</option>";
}
?>
</select>
</div></th>
<th><input name="submit" type="submit" value="Add Vessel">
<div align="center"> </div></th></tr>
<tr>
<th> </th>
</tr>
<tr>
<th><input name="submit" type="submit" value="Edit Vessel"></th>
</tr>
</form>
<!-- InstanceEndEditable -->
Page 2
<?php
if (isset($POST['cboinst']))
{
$inst_ch=$POST['cboinst'];
}
switch ($_POST['submit']) {
case 'Add Vessel': ?>
<form action="sv_t3.php" method="post">
<table width="100%" border="0" cellpadding="2" cellspacing="3">
Form Stuff
</form>
<?php
break;
case 'Edit Vessel':
?>
</Form>
<form action="svedit.php" method="post">
Form Stuff </form>
<? break;
case 'Add Window': ?>
<form action="sv_t3.php" method="post">
Form Stuff
</form>
<?php break;
case 'Edit Window': ?>
<form action="sv_t4.php" method="post">
Form Stuff
</form>
<?php break;
default: ?>
print 'You can put the html form here.';
<? break;
} // End: switch ($_GET['submit'])
</table>
</body>
</html>
<!-- InstanceEndEditable -->