Why isn't this working????

Echo '
<form action="show.php" method="post" onChange="this.form.submit()">
<select>
<option value selected>select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</form> ';

the onchange="this.form.submit()" goes in the select tag.

if the form has any form field named 'submit' than just rename it to 'submit2' or anything else than 'submit'. run the code.

If it still doesn't works provide more detail about the code.

okay, i agree upon the previous reply.

change ur code with this........
it will work .......

echo '
<form action="show.php" method="post" onChange="this.submit()">
<select>
<option value selected>select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" value="submit">
</form> ';

change ur code with this........
it will work .......

echo '
<form action="show.php" method="post" onChange="this.submit()">
<select>
<option value selected>select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" value="submit">
</form> ';

Replace your Double Quotes by Single Quotes, and vice versa.

echo "<form action='show.php' method='post' onChange='this.submit()'><select><option value selected>select</option><option value='1'>1</option><option value='2'>2</option></select><input type='submit' value='submit'></form> ";

Regards...

Replace your Double Quotes by Single Quotes, and vice versa.

echo "<form action='show.php' method='post' onChange='this.submit()'><select><option value selected>select</option><option value='1'>1</option><option value='2'>2</option></select><input type='submit' value='submit'></form> ";

Regards...

why....that is not necessary.

why....that is not necessary.

Sorry .... onChange="this.submit();" goes in the SELECT tag

Sorry .... onChange="this.submit();" goes in the SELECT tag

i was referring to replacing of the double quotes with single quotes. i was just wondering why you would do that. I really doesn't make much of a difference.

Thank you. My problem was the onchange was in the option not the select. Every other site neglects to mention that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.