Jump to content

ECHO "<SELECT ONCHANGE=\"WINDOW.OPEN(


mayu_bt

Recommended Posts

Hi Learned people,

I am using the below syntax to have popup window popping up when I select the option in the dropdown.


echo "<select onchange=\"window.open('breaktype.php?username= ', 'Edituser', 'width=500,height=400,scrollbars=1')\">";

echo "<option>--Select--</option>";
echo "<option value='C'>Coffee</option>";
echo "<option value='F'>Fag</option>";
echo "<option value='L'>Lunch</option>";
echo "<option value='O'>Others</option>";
echo "</select>";

How to pass the value selected from the drop down to the popup in the above syntax? if I mention this.option it takes the valuse as "this.option" itself!! but not the value selected in the dropdown... PLEASE HELP....

POPUP window is popping up fine with the above syntax.. the problem is passing the value selected in the dropdown....
Link to comment
https://forums.phpfreaks.com/topic/4698-echo/
Share on other sites

Create a js function:

[code]<script type="text/javascript">
function selectpops(a) {
    var value = a.selectedIndex.value;
    var win = window.open("breaktype.php?value=" + value, 'Edituser', 'width=500,height=400,scrollbars=1');
}
</script>

echo "<select onchange=\"selectpops(this)\">";

echo "<option>--Select--</option>";
echo "<option value='C'>Coffee</option>";
echo "<option value='F'>Fag</option>";
echo "<option value='L'>Lunch</option>";
echo "<option value='O'>Others</option>";
echo "</select>";[/code]
Link to comment
https://forums.phpfreaks.com/topic/4698-echo/#findComment-16605
Share on other sites

[!--quoteo(post=354118:date=Mar 12 2006, 07:29 AM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 12 2006, 07:29 AM) [snapback]354118[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Create a js function:

[code]<script type="text/javascript">
function selectpops(a) {
    var value = a.selectedIndex.value;
    var win = window.open("breaktype.php?value=" + value, 'Edituser', 'width=500,height=400,scrollbars=1');
}
</script>

echo "<select onchange=\"selectpops(this)\">";

echo "<option>--Select--</option>";
echo "<option value='C'>Coffee</option>";
echo "<option value='F'>Fag</option>";
echo "<option value='L'>Lunch</option>";
echo "<option value='O'>Others</option>";
echo "</select>";[/code]
[/quote]

Very good point hitman [=
Link to comment
https://forums.phpfreaks.com/topic/4698-echo/#findComment-16608
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.