Jump to content

Form within a form


DarkPrince2005

Recommended Posts

??? I've got a form that posts to another page that saves the changes made to a record. Is there a way that I can imbed another form in that form that posts the information to a different page that'll print it in a pdf file.

 

echo "<html><head><title>Edit Grievance Record</title><link rel='stylesheet' href='stylesheet.css' type='text/css'>
<style>

	a:link{font-family:'Verdana';

	color:'#000000';
	font-weight:700;
	text-decoration:none;
	}

	a:visited{font-family:'Verdana';

	color:'#000000';
	font-weight:700;
	text-decoration:None;
	}

	a:hover{font-family:'Verdana';

	text-decoration:none;
	color:'#B37A04';
	font-weight:700;
	}

	a:active{font-family:'Verdana';

	color:'#000000';
	font-weight:700;
	}
</style>";

echo "<script language=\"javascript\" type=\"text/javascript\" src=\"datetimepicker.js\"\n>;";


//Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
//Script featured on JavaScript Kit (http://www.javascriptkit.com)
//For this script, visit http://www.javascriptkit.com 

echo "</script>";
echo "</head><body bgcolor='#FDCC67' topmargin='0' bottommargin='0' leftmargin='0' rightmargin='0'>
<center><table width='100%' height='100%' cellpadding='0' cellspacing='0' border='0'>
<tr><td valign='top' width='140' background='graphics/nav.gif'><br><center><font size=3>MENU</font><br><img src='graphics/NavSeparator.gif' width=130></center><br>
	<font size='2'><a href='home.html'>  <img src='graphics/NavBullet.gif' border=0>  Home</a></font><br><br>
	<font size='2'><a href='grievancesview.php'>  <img src='graphics/NavBullet.gif' border=0>  View Records</a></font><br><br>
	<font size='2'><a href='grievancesadd.html'>  <img src='graphics/NavBullet.gif' border=0>  Add Record</a></font><br><br>
	<font size='2'><a href='grievancesedit.html'>  <img src='graphics/NavBullet.gif' border=0>  Edit Record</a></font><br><br>
	<font size='2'><a href='grievancesdelete.html'>  <img src='graphics/NavBullet.gif' border=0>  Delete Record</a></font><br><br>
	<font size='2'><a href='grievancesdatereport.html'>  <img src='graphics/NavBullet.gif' border=0>  View Report</a></font><br><br>
	<font size='2'><a href='grievancesq.html'>  <img src='graphics/NavBullet.gif' border=0>  Query Report</a></font><br><br>
	<font size='2'><a href='grievancessearch1.html'>  <img src='graphics/NavBullet.gif' border=0>  Search</a></font><br><br><br><center><img src='graphics/NavSeparator.gif' width=130></center><br></td><td valign='top' align='center'><table width='100%'><tr>
	<td align='center' valign='top'><h1><u>Edit Grievance</u></h1></td></tr>
	<td align='right' valign='top'><form name='search' action='grievancessearch3.php' method='post'><b>Search by Persal Number or Last Name:</b>  <input type='text' name='search'> <input type='submit' value='Search'></form></td></tr>
<tr><td align='center' valign='top'><center><font size=2 color='#ffffff'>"; 

// If current page number, use it 
// if not, set one! 

if(!isset($_GET['page'])){ 
    $page = 1; 
} else { 
    $page = $_GET['page']; 
} 

// Define the number of results per page 
$max_results =1; 

// Figure out the limit for the query based 
// on the current page number. 
$from = (($page * $max_results) - $max_results);  

// Perform MySQL query on only the current page number's results 

$sql = mysql_query("SELECT * FROM grievances LIMIT $from, $max_results"); 



// Figure out the total number of results in DB: 
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM grievances"),0); 

// Figure out the total number of pages. Always round up using ceil() 
$total_pages = ceil($total_results / $max_results); 

// Build Page Number Hyperlinks 

// Build Previous Link 
if($page > 1){ 
    $prev = ($page - 1); 
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> "; 
} 

for($i = 1; $i <= $total_pages; $i++){ 
    if(($page) == $i){ 
        echo "$i "; 
        } else { 
            echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; 
    } 
} 

// Build Next Link 
if($page < $total_pages){ 
    $next = ($page + 1); 
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\"> Next>></a>"; 
}while($row = mysql_fetch_array($sql)){ 
    // Build your formatted results here. 
    echo "</font><center>
<form action='grievancesedit2.php' method='post'>
<form action='new 3.php' method='post'>
<table cellpadding='0' border='0' cellspacing='0' width='600'><tr>
<td valign='top'><table>
<tr><td><b>File Ref</td><td> </td>
<td><input type='hidden' name='file_ref' value='$row[File_Ref]'>$row[File_Ref]</td></tr>
<tr><td><b>Firstname</td><td> </td>
<td><input type='text' name='employee_firstname' value='$row[Employee_Firstname]' size='20'></td></tr>
<tr><td><b>Lastname</td><td> </td>
<td><input type='text' name='employee_lastname' value='$row[Employee_Lastname]' size='20'></td></tr>

<tr><td><b>Persal Number</td><td> </td>
<td><input type='text' name='persal_number' value='$row[Persal_Number]' size='20'></td></tr>

<tr>
<td><b>Occupation:</b></td>
<td>&nbsp</td>
<td><input type='text' name='occupation' value='$row[Occupation]'></td></tr>

<tr>
<td><b>Gender:</b></td>
<td>&nbsp</td>
<td><select name='gender' id='gender'><option value='$row[Gender]'>$row[Gender]
<option value='Male'>Male
<option value='Female'>Female
</select></td>
</tr>

<tr>
<td><b>Race:</b></td>
<td>&nbsp</td>
<td><select name='race' id='race'><option value='$row[Race]'>$row[Race]
<option value='African'>African
<option value='Indian'>Indian
<option value='Coloured'>Coloured
<option value='White'>White
</select></td>
</tr>
</table></td>
<td> </td>
<td valign='top'>
<table width='300'>
<tr>
<td><b>Unit:</b></td>
<td>&nbsp</td>
<td><select name='unit' id='unit'><option value='$row[unit]'>$row[unit]
<option value='NPS'>NPS
<option value='DOS'>DOS
<option value='CS'>CS
<option value='WPU'>WPU
<option value='SCCU'>SCCU
<option value='AFU'>AFU
</select></td>
</tr>

<tr>
<td><b>Region:</b></td>
<td>&nbsp</td>
<td><select name='region' id='region'><option value='$row[Region]'>$row[Region]
<option value='KZN'>KZN
<option value='GP'>GP
<option value='LP'>LP
<option value='MP'>MP
<option value='WC'>WC
<option value='NC'>NC
<option value='EC'>EC
<option value='NW'>NW
<option value='FS'>FS
</select></td>
</tr>

<tr><td><b>File Opened</td><td> </td>
<td><input type='text' value='$row[File_Opened]' name='file_opened'></td</tr>

<tr><td><b>File Closed</td><td> </td>
<td><input type='text' value='$row[File_Closed]' name='file_closed'></td</tr>

<tr>
<td><b>Status:</b></td>
<td>&nbsp</td>
<td><select name='status' id='status'><option value='$row[status]'>$row[status]
<option value='Pending'>Pending
<option value='Closed'>Closed
</select></td>
</tr>

<tr>
<td><b>Category:</b></td>
<td>&nbsp</td>
<td><input type'text' name='category' value='$row[Category]'></td>
</tr>

</tr></table></td></tr></table>
<br>
<table width='600' cellpadding='0' cellspacing='0'>
<tr>
<td valign='top' colspan='3'><b>Status Report:</b></td>
</tr>

<tr>
<td> </td>
<td> </td>
<td><textarea cols='68' rows='10' name='status_report'>$row[status_Report]</textarea></td>
</tr></table>
<tr>
<td colspan=3 align=center><input type=submit value='Print'><br><input type=submit value='Save'></td>
</tr>
</table>
</form>
</form>";
}; 
?> 

Link to comment
https://forums.phpfreaks.com/topic/76026-form-within-a-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.