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,

😉

    i copy & paste yout code and its works great .

    its submiting the form .

    what is the problem ?

      My God... what I was missing was a simple <select NAME="NAV" because includer is using it...

      3 hours of looking at what is wrong... simple NAME="NAV"

      Please yahelb, excuse THE MORON (me) for taking your time....

      freaking NAME... grrr...

      Thanks a lot, and accept my apologies, please.

        Write a Reply...