Forum Moderators: coopster
In select.php, I have a drop down box which goes to an url once an option is selected, and the url processes the selected option.
select.php:
<head>
<title>select.php</title>
</head><script language="JavaScript" type="text/javascript">
<!--
function ChangePage(Opt_List)
{
var sel_dept = Opt_List.options[Opt_List.selectedIndex].value;
sel_dept = sel_dept * 1;
window.location="sel_dept_proc.php?dept=" + sel_dept ;
}
//-->
</script>
<body>
<form>
<select name="select_stuff" onChange="ChangePage(this);">
<option value = "1">blah1</option>
<option value = "2">blah2</option>
<option value = "3">blah3</option>
<form>
select_proc.php: It gets the value of the "select_stuff" and stores it to a session variable for future usage.
<?php
session_start();
include("../func.php");
$sel_dept = $_GET['dept'];
$_SESSION['department'] = $sel_dept;
?>
After select.php and select_proc.php is done, I click another link to access test.php.
test.php has checkboxes for users to click on.
test.php:
<form method = "post" action="test_proc.php" name = "test">
<input type = "checkbox" name = "cl_text[1]">$myrow[0]</input>
<input type = "checkbox" name =
"cl_text[2]">$myrow[0]</input>
<input type = "checkbox" name = 'cl_text[3]'>$myrow[0]</input>
<input name = "update" type = "submit" value = "Submit" onClick = "form.test.action;">
Let's say I click on checkbox 2 and 3.
After I click submit on test.php, the url is suppose to show
[something.com...]
but it shows [something.com...]
so test_proc.php was never executed
So I think there is something wrong with the javascript (which i don't know how to fix).
Does anyone know how to fix this problem? or is there a way to store the value of sel_dept without using javascript?
Please give me some guidance, I have been trying to figure it out for a while.
Best Regards
Opiston
onClick = "form.test.action;"
and what happens if you delete that handler?
http://www.example.net/test_proc.php?sel_dept=2&cl_text%5B0%5D=on&cl_text%5B1%5D=&update=Submit
The action (test_proc.php) becomes the new page address, followed by the query_string