Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.