Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxxAPC, How to unsubscrube from dategen spam, WWWXXXAPC, docmd.close 2585, WWWXXXDOCO, nu vot, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text, how to setup procmail html2text

Links

XODOX
Impressum

#1: change php variable depending on selection

Posted on 2008-01-21 02:51:37 by php-general

Hi,

I've looked everywhere on the web (except of course the place that has the
answer ;) ) but can't seem to find a solution.

I'm trying to build an rss reader on a webpage. The idea is simple: there's
a dropdown box where you select the name of the blog and when you select the
blog you want to view a variable in the php script changes that captures the
rss feed of that blog. The db is setup so that the name of the blog is
stored next to the rss feed of the blog. If I'm thinking of this correctly
I've developed the dropdown box so that it populates from my db the name of
the blogs I have stored. I can't seem to figure out how to, when you select
matt'sblog (for example), how to make it so that the php variable will be
populated with the rssfeed of matt's blog and then the feed will show. For
instance, selecting matt'sblog from the drop down list will make it so that
$url="rss feed from matt'sblog" (which is stored in the db next to the name
of the blog). Make sense?

thx in advance for any help!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#2: Re: change php variable depending on selection

Posted on 2008-01-21 03:05:25 by Nathan Nobbe

------=_Part_10405_2479361.1200881125023
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Jan 20, 2008 8:51 PM, PHP-General <stpra123@gmail.com> wrote:

> Hi,
>
> I've looked everywhere on the web (except of course the place that has the
> answer ;) ) but can't seem to find a solution.
>
> I'm trying to build an rss reader on a webpage. The idea is simple:
> there's
> a dropdown box where you select the name of the blog and when you select
> the
> blog you want to view a variable in the php script changes that captures
> the
> rss feed of that blog. The db is setup so that the name of the blog is
> stored next to the rss feed of the blog. If I'm thinking of this correctly
> I've developed the dropdown box so that it populates from my db the name
> of
> the blogs I have stored. I can't seem to figure out how to, when you
> select
> matt'sblog (for example), how to make it so that the php variable will be
> populated with the rssfeed of matt's blog and then the feed will show. For
> instance, selecting matt'sblog from the drop down list will make it so
> that
> $url="rss feed from matt'sblog" (which is stored in the db next to the
> name
> of the blog). Make sense?


so, you just want to submit a request to the server once someone makes a
selection?
you need to use the onselect dom level 0 event (easiest way [w/o requiring
users to
press a submit button]). then you will have a javascript function to submit
the form,
eg.
// assume the select tag has id="rssFeedSelector"
// assume the form the select is in has id="rssSelectionForm
// then the javascript would look (roughly) something like this (put it in
the head tag of your page)

window.onLoad = function() {
document.getElementById('rssFeedSelector').onchange = function() {
document.getElementById('rssSelectionForm').submit();
}
}

-nathan

------=_Part_10405_2479361.1200881125023--

Report this message

#3: Re: change php variable depending on selection

Posted on 2008-01-21 03:51:59 by php-general

thx for the reply but i am a bit confused (i am new to php and even to
javascript)


Where would I put the javascript portion (the window.onLoad part), then?
Here is the relevant portion of the code. My test page can be seen at
http://valueinvestingplanet.com/test. The idea is to have the rss feed show
up on that page after you select which feed you want.

thx again!

<form id="rssSelectionForm" name="form1" method="POST" action="<?php echo
$editFormAction; ?>" >
<label>
<select name="rssFeedSelector" id="feedselector">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['blogname']?>"<?php if
(!(strcmp($row_Recordset1['blogname'], $row_Recordset1['blogname']))) {echo
"selected=\"selected\"";} ?>><?php echo
$row_Recordset1['blogname']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
</label>
<input type="hidden" name="MM_update" value="form1" />
</form>
<?php
mysql_free_result($Recordset1);
?>

""Nathan Nobbe"" <quickshiftin@gmail.com> wrote in message
news:7dd2dc0b0801201805t3099a87bvcaeec27fd1bb49ec@mail.gmail .com...
> On Jan 20, 2008 8:51 PM, PHP-General <stpra123@gmail.com> wrote:
>
>> Hi,
>>
>> I've looked everywhere on the web (except of course the place that has
>> the
>> answer ;) ) but can't seem to find a solution.
>>
>> I'm trying to build an rss reader on a webpage. The idea is simple:
>> there's
>> a dropdown box where you select the name of the blog and when you select
>> the
>> blog you want to view a variable in the php script changes that captures
>> the
>> rss feed of that blog. The db is setup so that the name of the blog is
>> stored next to the rss feed of the blog. If I'm thinking of this
>> correctly
>> I've developed the dropdown box so that it populates from my db the name
>> of
>> the blogs I have stored. I can't seem to figure out how to, when you
>> select
>> matt'sblog (for example), how to make it so that the php variable will be
>> populated with the rssfeed of matt's blog and then the feed will show.
>> For
>> instance, selecting matt'sblog from the drop down list will make it so
>> that
>> $url="rss feed from matt'sblog" (which is stored in the db next to the
>> name
>> of the blog). Make sense?
>
>
> so, you just want to submit a request to the server once someone makes a
> selection?
> you need to use the onselect dom level 0 event (easiest way [w/o requiring
> users to
> press a submit button]). then you will have a javascript function to
> submit
> the form,
> eg.
> // assume the select tag has id="rssFeedSelector"
> // assume the form the select is in has id="rssSelectionForm
> // then the javascript would look (roughly) something like this (put it in
> the head tag of your page)
>
> window.onLoad = function() {
> document.getElementById('rssFeedSelector').onchange = function() {
> document.getElementById('rssSelectionForm').submit();
> }
> }
>
> -nathan
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#4: Re: change php variable depending on selection

Posted on 2008-01-21 04:27:00 by Nathan Nobbe

------=_Part_10559_32947530.1200886020046
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

here is a complete, working example; hope it helps.
http://nathan.moxune.com/exampleDynamicSelect.php

-nathan

------=_Part_10559_32947530.1200886020046--

Report this message

#5: Fwd: change php variable depending on selection

Posted on 2008-01-21 16:43:50 by Nathan Nobbe

------=_Part_12469_19185633.1200930230980
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
Content-Disposition: inline

LS0tLS0tLS0tLSBGb3J3YXJkZWQgbWVzc2FnZSAtLS0tLS0tLS0tCkZyb206 IE5hdGhhbiBOb2Ji
ZSA8cXVpY2tzaGlm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eyA/PgogICAgICAgICAgICAg ICAgPG9wdGlvbiB2
YWx1ZT0iPD89JGN1ckZlZWROYW1lPz4iPgogICAgICAgICAgICAgICAgICAg IDw/PSRjdXJGZWVk
VmFsdWU/PgogICAgICAgICAgICAgICAgPC9vcHRpb24+CiAgICAgICAgICAg IDw/cGhwIH0gPz4K
d2lsbCBiZWNvbWUKICAgICAgICAgICAgPD9waHAgZm9yZWFjaCgkcnNzRmVl ZHMgYXMgICRjdXJG
ZWVkKSB7ID8+CiAgICAgICAgICAgICAgICA8b3B0aW9uIHZhbHVlPSIgPD89 JGN1ckZlZWRbJ2Zl
ZWRVcmwnXT8+Ij4KICAgICAgICAgICAgICAgICAgICA8Pz0kY3VyRmVlZFsn ZmVlZE5hbWUnXT8+
CiAgICAgICAgICAgICAgICA8L29wdGlvbj4KICAgICAgICAgICAgIDw/cGhw IH0gPz4KdGhlbiwg
d2hlbiB0aGUgdXNlciBtYWtlcyBhIHNlbGVjdGlvbiwgdGhlIHZhbHVlIG9m IHRoZSAkc2VsZWN0
ZWRWYWx1ZQp2YXJpYWJsZSAoZnJvbQp0aGUgZXhhbXBsZSBzY3JpcHQpIHdp bGwgYmUgdGhlIHVy
bCBvZiB0aGUgZmVlZCB0aGV5IHdvdWxkIGxpa2UgdG8gc2VlLgoKLW5hdGhh bgo=
------=_Part_12469_19185633.1200930230980--

Report this message