Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Mar 2011
    Thanked 0 Times in 0 Posts

    Question Question - A simple way to get dropdown menu output into a PHP variable?

    Iím trying to get the output of a dropdown menu into a php variable so I can use it to do queries etc.

    The following code does work, but the div tags are also saved in the variable. Is there another way of doing it without the div tags? Maybe using _GET.

    Ideally I would like minimal javascript like in my example instead of an external chunk of javascript so I can easily add more dropdown menus in the future.

    <select name='trade' onchange="document.getElementById('extra').innerHTML = this.value;">
       <option value='item1'>item1</option>
       <option value='item2'>item2</option>
       <option value='item3'>item3</option>
       <option value='item4'>item4</option>
    $extra = '<div id="extra"></div>';
    echo $extra
    Last edited by foxystoat; 03-03-2011 at 01:35 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts