I'm having problems getting these two to work in concert. I'm trying to create a level of security to a popup I wish to have. The problem is that the var3 and var4 that are put into the URL are not the same as the var3 and var4 sent to the script from the buttons.
important code is as follows:
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function SubmitIt(a,var3,var4) {
if (a==1){
var1 = document.financials.mmonth.value;
var2 = document.financials.myear.value;
}
else if(a==2){
var1 = document.financials.qmonth.value;
var2 = document.financials.qyear.value;
}
else if(a==3){
var1 = 'blank';
var2 = document.financials.yyear.value;
}
txt1 = "tester.php?month=";
txt2 = "&year=";
txt3 = "&temp1=";
txt4 = "&temp2=";
var direct = txt1+var1+txt2+var2+txt3+var3+txt4+var4;
window.open(direct,'tester','width=400,height=250');
}
//-->
</script>
<?php
function makeRandomPassword() {
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$random_password = makeRandomPassword();
$timeis = mktime();
?>
<form name="financials">
<select name="mmonth" id="mmonth"></select>
<select name="myear"></select>
<input value="Get Report" type="button" onClick="SubmitIt(1, <?php echo $timeis; ?>, <?php echo $random_password; ?>)">
<select name="qmonth" id="qmonth"></select>
<select name="qyear"></select>
<input value="Get Report" type="button" onClick="SubmitIt(2, <?php echo $timeis; ?>, <?php echo $random_password; ?>)">
<select name="yyear"></select>
<input value="Get Report" type="button" onClick="SubmitIt(3, <?php echo $timeis; ?>, <?php echo $random_password; ?>)">
</form>