dropdown need to be set with values coming from last page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shubhangi
Forum Newbie
Posts: 4
Joined: Wed Jul 08, 2009 6:46 am

dropdown need to be set with values coming from last page

Post by shubhangi »

Hi,
i have a php script. where a form has been placed.
There are some dropdowns placed on this form.
These dropdowns will follow a auto post back.

This much wrking fine i would like to change the code to set the dropdowns to the values coming from last page.

Please find attached code.

Thx in advance.

probs in attaching file..
pls see code below
************************
<html>
<head>
<script type="text/javascript" src='DatePicker.js'></script>
</head>
<body >
<form name="frm2" method="GET" >
<form name="frm1" method="GET" enctype="multipart/form-data">

<form name="frmcertiPage" action="<?php $PHP_SELF ?>" method="GET" enctype="multipart/form-data">
<table style="font-family:Arial; font-size:12px; color:#000000" bgcolor="#FFFFFF">

<?php
$i = 1;
echo "<input type=\"hidden\" name=\"temp\" value=\"$_GET[flag]\" />";
Require ("dbconnection.php");
echo "<script type=\"text/javascript\" src='DatePicker.js'></script>";
echo "<tr><td>Competency</td><td>";

//Competency
$query1 = mysql_query("select distinct Competency from tbl_certification ORDER BY Competency");
echo "<select name=\"certi_type\" onchange=\"this.form.submit();\" method=\"GET\">";
echo "<option value=\"\">Please Select</option>";
while($result1 = mysql_fetch_assoc($query1)){
?>
<option <?php if ($result1['Competency']==$_GET['certi_type'])
{echo 'selected="selected"';}?>
value="<?php echo $result1['Competency'];?>">
<?php echo $result1['Competency'];?> </option>
<?php }
echo "</select><br>";
echo"</tr>";

//Stream
echo "<tr><td>Stream</td><td>";
echo "<select name=\"stream_name\" onchange=\"this.form.submit();\" method=\"GET\">n";
if (!isset($_GET['certi_type']))
{ echo "<option value=null selected>Please Select</option>n"; }
else
{
$query2 = mysql_query("select distinct Stream from tbl_certification where Competency='$_GET[certi_type]' ORDER BY Stream");
echo "<option value=\"\">Please Select</option>";
while($result2 = mysql_fetch_assoc($query2)){?>
<option <?php if ($result2['Stream']==$_GET['stream_name'])
{echo 'selected="selected"';}?>
value="<?php echo $result2['Stream'];?>">
<?php echo $result2['Stream'];?> </option>
<?php }
echo "</select>";
}
echo"</tr>";

//Certification
echo "<tr><td>Certification</td><td>";
echo "<select name=\"certification_name\" onchange=\"this.form.submit();\" method=\"GET\">n";
if (!isset($_GET['certi_type'])) { echo "<option value=null selected>Please Select</option>n"; }
else{
$query3 = mysql_query("select Certification from tbl_certification where Competency='$_GET[certi_type]' and Stream ='$_GET[stream_name]' ORDER BY certification");
echo "<option value=\"\">Please Select</option>";
while($result3 = mysql_fetch_assoc($query3)){?>
<option <?php if ($result3['Certification']==$_GET['certification_name'])
{echo 'selected="selected"';}?>
value="<?php echo $result3['Certification'];?>">
<?php echo $result3['Certification'];?> </option>
<?php }
echo "</select>";
}
echo "</tr>";
echo "<tr><td>status</td>";
echo "<td><select name=\"status\" onchange=\"javscript:show(this.selectedIndex)\">";

echo "<option>Planned</option>";
echo "<option>Completed</option>";
echo "</select></td>";

echo "<td>";
echo "<div id=\"div1\" style=\"visibility:hidden\">";
echo "Manager's ID";echo "</div></td><td>";
echo "<div id=\"div2\" style=\"visibility:hidden\">";
echo "<input type=\"text\" name=\"mgr_name\"/>";
echo "</div></td>";
echo "</tr>";

//Date for planned certificate
echo"<tr>";
echo"<td>Date</td>";
echo"<td><input type=\"text\" value=\"$_GET[certi_date]\" name=\"Certi_Date\">";
echo"<input type=image name=\"Cal\" src=\"Images/cal.gif\" alt=\"pick date\" onclick=\"javscript:displayDatePicker('Certi_Date',false, 'ymd', '-');return false;\">" ;
echo"</td></tr>";

echo "</table>";
echo "</form>";
echo"<table><tr><tr>";
echo "<INPUT TYPE=\"button\" name=\"submit\" method=\"GET\" onClick = \"javascript:decide_action_update();\" VALUE=\"Submit\"/>";
echo"</tr> </table>";
echo "<tr><td> <a href=\"My_Details.php\">Back</a></td></tr>";
echo"</form>";
echo"</form>";
?>
</body>
</html>
**********************
Post Reply