Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-03-2011, 11:13 AM   PM User | #1
foxystoat
New to the CF scene

 
Join Date: Mar 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
foxystoat is an unknown quantity at this point
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.

Code:
<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>
</select>

<?php

$extra = '<div id="extra"></div>';

echo $extra

?>

Last edited by foxystoat; 03-03-2011 at 12:35 PM..
foxystoat is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:10 PM.


Advertisement
Log in to turn off these ads.