PHP Form DropDown Menu
Posted: Tue Apr 25, 2006 4:24 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi Guys,
I have a session problem here. Anyone know why I will lost my session and log off when I select the Option from the drop down menu please?Code: Select all
<script language="javascript">
// FUNCTION - DROP-DOWN MENU
// This function runs the "productSelect" drop down menu
function postBack()
{
//document.selectProduct.submit();
document.sec.submit();
var val=document.selectProduct.products.options[document.selectProduct.products.selectedIndex].value;
location='support_test3.php?products=' + val ;
}
</script>
<!-- BEGIN PHP SCRIPT -->
<!-- begin graphic header -->
<form method="post" action="support_test3.php" name="sec">
<input type="hidden" name=username value=<?php echo $_POST['username'];?>></input>
<input type="hidden" name=password value=<?php echo $_POST['password'];?>></input>
<input type="hidden" name="login" value=''></input>
</form>
<div class="topGraphic">
<form action="<? echo $_SERVER['PHP_SELF']; // Basically prints "/support.php" ?>"
method="post" name="selectProduct" style="border:0px ; margin: 0px; padding: 0px;">
<div style="background-image:url(
<?
// If statement - If "$supportauth" EQUALS EXACTLY "1" (if "check_pass" was approved), run the code below.
if($login_pass == 1 ||$userdata['session_logged_in']) {
echo "images/support/supportproductsselect3.jpg);"; // Set the new Support image (logged in) as the div's bg image.
} else {
echo "images/support/supportproducts_03.jpg);"; // Set the default Support banner as the div's bg image.
}
?>
background-position:top; background-repeat:no-repeat; width:737px; height:106px; ">
<div style="position:relative; top:49px; left:205px; display:<?
if($login_pass == 1 ||$userdata['session_logged_in']) {
echo "block";
}else{
echo "none";
} // Print whatever was selected
// in the print_combo function
// (either "block" or "none")
?> ">
<select name="products" onchange="postBack()">
<option selected value="0">(Please select:)</option>
<option value="0">---------------------------</option>
<option value="1">Admin Tool 3.5</option>
<option value="4">Admin Tool 3.4.3</option>
<option value="0">---------------------------</option>
<option value="3">Incident Reporting 3.4.3</option>
<option value="5">Incident Reporting 3.4.2</option>
</select>
<? $products=$HTTP_GET_VARS['products'];?>
</div>
</div>
<div>
<!-- These are the title images located directly below the main header graphic -->
<img src="<?
$products=$HTTP_GET_VARS['products'];
// If statement - If that number is selected (in the drop down menu), display the accompanying title image.
switch ($products){
case "1" :
echo "./images/support/SOC.jpg";
break;
case "2" :
echo "./images/support/IR35.jpg";
break;
case "3" :
echo "./images/support/IR343.jpg";
break;
case "4" :
echo "./images/support/IR343admin.jpg";
break;
case "5" :
echo "./images/support/IR342.jpg";
break;
default :
echo "./images/support/supportproducts_su.jpg";
break;
}
?> ">
</div>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]