after selecting new item from pull down menu my script should reload page with new options depending on item selected. Unfortunately it doesn't.
Instead first position is being selected. But when I choose same item for the second time, it works perfectly.
It repeats every time I first run the script (page).
This is my script (part of it):
Code: Select all
<?php
$formVars = array();
if(!session_is_registered($_SESSION['formVars'])) session_register("formVars");
foreach($_POST as $varname => $value) $formVars[$varname] = $value;
?>
<FORM NAME="DataBase" METHOD="POST" ACTION="BazaEB.php?action=raporty&sub=platnosci">
<SELECT NAME="TypRaportu"onChange="this.form.action='BazaEB.php?action=raporty&sub=platnosci';this.form.method='POST';this.form.submit();">
<?php
my_connect("BazaEB");
$query = "SELECT DBReports.nazwa FROM DBReports ";
$query .= "WHERE DBReports.typ='Pymt' ORDER BY DBReports.nazwa;";
$wynik = sql("BazaEB",$query);
while ($rekord = mysql_fetch_array ($wynik)) {
if($formVars['TypRaportu']){
if($formVars['TypRaportu'] == $rekord[0]) echo " <OPTION SELECTED>$rekord[0]\n"
else echo " <OPTION>$rekord[0]\n";
}
else {
if(ereg("Select",$rekord[0])) echo "<OPTION SELECTED>$rekord[0]\n"
else echo " <OPTION>$rekord[0]\n";
}
}
?>Rest of the script behaves correctly, it means it's being extended according to the option that should
be chosen from pull-down menu.
It is strange but I had not such problems on Windows. I have them on newly set-up Linux. Perhaps
some PHP configuration missing?
System: RedHat 9.0, PHP 4.2.2, Apache 2.0.40, mysql 3.23.54
Thanks in advance for any hint,
regards,
Maciek