I have a form that creates it's options automatically, by listing title tags from the corresponding folder.
At some point I wanted to get rid of the Submit button and use
<select onchange="this.form.submit()">
But it doesn't work. My guess is that variables are not passed on.
The code looks like this:
<form action="<?=$_SERVER['PHP_SELF']?>" method="get">
<p class="bodytext"></p>
<table>
<tr>
<td width="300" align="right" valign="middle">
<input name="page" type="hidden" value="portfolio" />
<select onchange="this.form.submit()">
<option value="">Web Design</option>
<option value="">------------------</option>
<?php
foreach ($filelist as $file) {
$filepath = $directory.$separator.$file;
$fp = fopen($filepath, 'r');
$contents = fread($fp, 80);
fclose($fp);
$preg="/<title>(.*?)<\/title>/";
if (preg_match_all($preg, $contents, $match)) {
echo("<option value=\"".$remdirectory.$file."\">" . $match[1][0] . "</option>\n");
} else {
echo("<option value=\"".$remdirectory.$file."\">" . $file . "</option>\n");
}
}
?>
</select></td>
Have I placed the <select onchange="this.form.submit()"> and </select> tags into the wrong place? What did I do wrong?
Thx,