|
Posted by Kimmo Laine on 07/12/06 07:55
"IchBin" <weconsul@ptd.net> wrote in message
news:DaidnbzhffngEynZUSdV9g@ptd.net...
> This is very new to me, scripting languages. I am trying to get the
> /select id off of a dropdownlist, which really does not drop down and is
> more like a flat list??, at an onchange event. Then move it into a php var
> to retrieve different data from db. Not that it matters but I load about
> 1200 items in to the list and was surprised how fast it is.
>
> Could some one give me some direction?
>
> <? $location ?> =
> "document.author.author_pk.options[document.author.author_pk.selectedIndex].value
> ";
This doesn't work. Very very wrong approach. I see what you've tried to
accomplish here but I must say this isn't the way php works, you can't
assign a php variable from javascript like this.
Here's a list of things to do for you:
a) Add an action to your form, action="<?php echo $_SERVER['PHP_SELF'] ?> is
a good choice in this case.
b) Add a method to your form, and I recommend method="get" in this case.
c) Add a submit button to you form, a simple <input type="submit"/> will do
just fine for now.
d) Add this to your code
<?php
print_r($_GET); // This is just for debugging purpouses
$location=$_GET['author_pk']; // this be the real magic
echo "Location is: $location";
?>
e) click the fine submit button you've added and observe what happens.
f) if you really want a drop down list rather than a flat list, then remove
the size=20 from it.
g) report back what you've achieved and learned from this experience.
--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
Navigation:
[Reply to this message]
|