FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to transfer value to iframe?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
How to transfer value to iframe? [message #183123] Thu, 10 October 2013 02:32 Go to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
http://mroldies.net/200/audiox.php

First, the sound will work only in firefox.
So don't go bashing me for that.

I have it set up so that a shuffled array will be displayed any time the
page is loaded. Hopefully.
What I want to do is to ensure that item one in the menu list will match
what is in the iframe.

$_get[] relies on the values being transferred via a link.
At this point, no link has been clicked on to set the value.
So how do I properly set the intitial value?


<div id="menu1">


<?php

$numbers=range(1,60);
shuffle($numbers);

foreach ($numbers as $play) {

echo "<div class='item'>";


$year=$playme[$play][0];
$rank=$playme[$play][1];
$asong=$playme[$play][2];
$art=$playme[$play][3];

echo $asong;
echo "<br>";
echo $art;
echo "<br>";
echo $year;
echo " # ";
echo $rank;

echo "</div>";

$songid=$numbers[0]; << this reults in"1" always being piinted.

};

?>



</div>
Re: How to transfer value to iframe? [message #183124 is a reply to message #183123] Thu, 10 October 2013 03:13 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
richard wrote:

> http://mroldies.net/200/audiox.php
>
> First, the sound will work only in firefox.
> So don't go bashing me for that.
>
> I have it set up so that a shuffled array will be displayed any time the
> page is loaded. Hopefully.
> What I want to do is to ensure that item one in the menu list will match
> what is in the iframe.
>
> $_get[] relies on the values being transferred via a link.

Not so - it uses the query string -
https://en.wikipedia.org/wiki/Query_string - which may be passed via a
clickable link, or as part of a URL

> At this point, no link has been clicked on to set the value.
> So how do I properly set the intitial value?

<iframe id="x1" src="audiox1.php?a=foo&b=bar&c=baz" name="alpha"></iframe>

Simply pass the value(s) you need to utilise in the iframe
>
> <div id="menu1">
>
>
> <?php
>
> $numbers=range(1,60);
> shuffle($numbers);
>
> foreach ($numbers as $play) {
>
> echo "<div class='item'>";
>
>
> $year=$playme[$play][0];
> $rank=$playme[$play][1];
> $asong=$playme[$play][2];
> $art=$playme[$play][3];
>
> echo $asong;
> echo "<br>";
> echo $art;
> echo "<br>";
> echo $year;
> echo " # ";
> echo $rank;
>
> echo "</div>";
>
> $songid=$numbers[0]; << this reults in"1" always being piinted.
>
> };
>
> ?>
>
>
>
> </div>

--
Cheers
David Robley

Useless Invention: Low-calorie PowerBar.
Re: How to transfer value to iframe? [message #183125 is a reply to message #183124] Thu, 10 October 2013 03:31 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Thu, 10 Oct 2013 13:43:42 +1030, David Robley wrote:

> richard wrote:
>
>> http://mroldies.net/200/audiox.php
>>
>> First, the sound will work only in firefox.
>> So don't go bashing me for that.
>>
>> I have it set up so that a shuffled array will be displayed any time the
>> page is loaded. Hopefully.
>> What I want to do is to ensure that item one in the menu list will match
>> what is in the iframe.
>>
>> $_get[] relies on the values being transferred via a link.
>
> Not so - it uses the query string -
> https://en.wikipedia.org/wiki/Query_string - which may be passed via a
> clickable link, or as part of a URL
>
>> At this point, no link has been clicked on to set the value.
>> So how do I properly set the intitial value?
>
> <iframe id="x1" src="audiox1.php?a=foo&b=bar&c=baz" name="alpha"></iframe>
>
> Simply pass the value(s) you need to utilise in the iframe

I tried this

<iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>


Assigining songid as $songid=$play[0];

Retrieving value through


$number=$_GET["asong"];

echo $number;



Results in "songid" being printed.
Re: How to transfer value to iframe? [message #183126 is a reply to message #183125] Thu, 10 October 2013 03:50 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
richard wrote:

> On Thu, 10 Oct 2013 13:43:42 +1030, David Robley wrote:
>
>> richard wrote:
>>
>>> http://mroldies.net/200/audiox.php
>>>
>>> First, the sound will work only in firefox.
>>> So don't go bashing me for that.
>>>
>>> I have it set up so that a shuffled array will be displayed any time the
>>> page is loaded. Hopefully.
>>> What I want to do is to ensure that item one in the menu list will match
>>> what is in the iframe.
>>>
>>> $_get[] relies on the values being transferred via a link.
>>
>> Not so - it uses the query string -
>> https://en.wikipedia.org/wiki/Query_string - which may be passed via a
>> clickable link, or as part of a URL
>>
>>> At this point, no link has been clicked on to set the value.
>>> So how do I properly set the intitial value?
>>
>> <iframe id="x1" src="audiox1.php?a=foo&b=bar&c=baz"
>> name="alpha"></iframe>
>>
>> Simply pass the value(s) you need to utilise in the iframe
>
> I tried this
>
> <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
>
>
> Assigining songid as $songid=$play[0];
>
> Retrieving value through
>
>
> $number=$_GET["asong"];
>
> echo $number;
>
>
>
> Results in "songid" being printed.

Not surprisingly, because that is what you have set as the value for asong
in the iframe link. If you want to pass a value contained in a variable, you
should use the variable, not a string. Look closely at what you are doing
when calling the iframe.

<iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
--
Cheers
David Robley

Useless Invention: Inflatable PC -- The Ultimate Laptop!
Re: How to transfer value to iframe? [message #183128 is a reply to message #183126] Thu, 10 October 2013 04:01 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Thu, 10 Oct 2013 14:20:56 +1030, David Robley wrote:

> richard wrote:
>
>> On Thu, 10 Oct 2013 13:43:42 +1030, David Robley wrote:
>>
>>> richard wrote:
>>>
>>>> http://mroldies.net/200/audiox.php
>>>>
>>>> First, the sound will work only in firefox.
>>>> So don't go bashing me for that.
>>>>
>>>> I have it set up so that a shuffled array will be displayed any time the
>>>> page is loaded. Hopefully.
>>>> What I want to do is to ensure that item one in the menu list will match
>>>> what is in the iframe.
>>>>
>>>> $_get[] relies on the values being transferred via a link.
>>>
>>> Not so - it uses the query string -
>>> https://en.wikipedia.org/wiki/Query_string - which may be passed via a
>>> clickable link, or as part of a URL
>>>
>>>> At this point, no link has been clicked on to set the value.
>>>> So how do I properly set the intitial value?
>>>
>>> <iframe id="x1" src="audiox1.php?a=foo&b=bar&c=baz"
>>> name="alpha"></iframe>
>>>
>>> Simply pass the value(s) you need to utilise in the iframe
>>
>> I tried this
>>
>> <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
>>
>>
>> Assigining songid as $songid=$play[0];
>>
>> Retrieving value through
>>
>>
>> $number=$_GET["asong"];
>>
>> echo $number;
>>
>>
>>
>> Results in "songid" being printed.
>
> Not surprisingly, because that is what you have set as the value for asong
> in the iframe link. If you want to pass a value contained in a variable, you
> should use the variable, not a string. Look closely at what you are doing
> when calling the iframe.
>
> <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>

so my question kind of still stands.
how do I make asong=?????? as the given initial value of the shuffled
array?
Re: How to transfer value to iframe? [message #183129 is a reply to message #183128] Thu, 10 October 2013 04:40 Go to previous messageGo to next message
Jeff North is currently offline  Jeff North
Messages: 58
Registered: November 2010
Karma: 0
Member
On Thu, 10 Oct 2013 00:01:56 -0400, in comp.lang.php richard
<noreply(at)example(dot)com>
<1072h1gn3qh4z(dot)axclc9ryd5s7$(dot)dlg(at)40tude(dot)net> wrote:

> | On Thu, 10 Oct 2013 14:20:56 +1030, David Robley wrote:
> |
> | > richard wrote:
> | >
> | >> On Thu, 10 Oct 2013 13:43:42 +1030, David Robley wrote:
> | >>
> | >>> richard wrote:
> | >>>
> | >>>> http://mroldies.net/200/audiox.php
> | >>>>
> | >>>> First, the sound will work only in firefox.
> | >>>> So don't go bashing me for that.
> | >>>>
> | >>>> I have it set up so that a shuffled array will be displayed any time the
> | >>>> page is loaded. Hopefully.
> | >>>> What I want to do is to ensure that item one in the menu list will match
> | >>>> what is in the iframe.
> | >>>>
> | >>>> $_get[] relies on the values being transferred via a link.
> | >>>
> | >>> Not so - it uses the query string -
> | >>> https://en.wikipedia.org/wiki/Query_string - which may be passed via a
> | >>> clickable link, or as part of a URL
> | >>>
> | >>>> At this point, no link has been clicked on to set the value.
> | >>>> So how do I properly set the intitial value?
> | >>>
> | >>> <iframe id="x1" src="audiox1.php?a=foo&b=bar&c=baz"
> | >>> name="alpha"></iframe>
> | >>>
> | >>> Simply pass the value(s) you need to utilise in the iframe
> | >>
> | >> I tried this
> | >>
> | >> <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
> | >>
> | >>
> | >> Assigining songid as $songid=$play[0];
> | >>
> | >> Retrieving value through
> | >>
> | >>
> | >> $number=$_GET["asong"];
> | >>
> | >> echo $number;
> | >>
> | >>
> | >>
> | >> Results in "songid" being printed.
> | >
> | > Not surprisingly, because that is what you have set as the value for asong
> | > in the iframe link. If you want to pass a value contained in a variable, you
> | > should use the variable, not a string. Look closely at what you are doing
> | > when calling the iframe.
> | >
> | > <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
> |
> | so my question kind of still stands.
> | how do I make asong=?????? as the given initial value of the shuffled
> | array?

Shhheeeeesssshhh.
<iframe id="x1" src="audiox1.php?asong="+songid name="alpha"></iframe>
Re: How to transfer value to iframe? [message #183130 is a reply to message #183129] Thu, 10 October 2013 04:51 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Thu, 10 Oct 2013 15:40:55 +1100, Jeff North wrote:

> On Thu, 10 Oct 2013 00:01:56 -0400, in comp.lang.php richard
> <noreply(at)example(dot)com>
> <1072h1gn3qh4z(dot)axclc9ryd5s7$(dot)dlg(at)40tude(dot)net> wrote:
>
>> | On Thu, 10 Oct 2013 14:20:56 +1030, David Robley wrote:
>> |
>> | > richard wrote:
>> | >
>> | >> On Thu, 10 Oct 2013 13:43:42 +1030, David Robley wrote:
>> | >>
>> | >>> richard wrote:
>> | >>>
>> | >>>> http://mroldies.net/200/audiox.php
>> | >>>>
>> | >>>> First, the sound will work only in firefox.
>> | >>>> So don't go bashing me for that.
>> | >>>>
>> | >>>> I have it set up so that a shuffled array will be displayed any time the
>> | >>>> page is loaded. Hopefully.
>> | >>>> What I want to do is to ensure that item one in the menu list will match
>> | >>>> what is in the iframe.
>> | >>>>
>> | >>>> $_get[] relies on the values being transferred via a link.
>> | >>>
>> | >>> Not so - it uses the query string -
>> | >>> https://en.wikipedia.org/wiki/Query_string - which may be passed via a
>> | >>> clickable link, or as part of a URL
>> | >>>
>> | >>>> At this point, no link has been clicked on to set the value.
>> | >>>> So how do I properly set the intitial value?
>> | >>>
>> | >>> <iframe id="x1" src="audiox1.php?a=foo&b=bar&c=baz"
>> | >>> name="alpha"></iframe>
>> | >>>
>> | >>> Simply pass the value(s) you need to utilise in the iframe
>> | >>
>> | >> I tried this
>> | >>
>> | >> <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
>> | >>
>> | >>
>> | >> Assigining songid as $songid=$play[0];
>> | >>
>> | >> Retrieving value through
>> | >>
>> | >>
>> | >> $number=$_GET["asong"];
>> | >>
>> | >> echo $number;
>> | >>
>> | >>
>> | >>
>> | >> Results in "songid" being printed.
>> | >
>> | > Not surprisingly, because that is what you have set as the value for asong
>> | > in the iframe link. If you want to pass a value contained in a variable, you
>> | > should use the variable, not a string. Look closely at what you are doing
>> | > when calling the iframe.
>> | >
>> | > <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
>> |
>> | so my question kind of still stands.
>> | how do I make asong=?????? as the given initial value of the shuffled
>> | array?
>
> Shhheeeeesssshhh.
> <iframe id="x1" src="audiox1.php?asong="+songid name="alpha"></iframe>

Wonder why I get absolutely nothing as a reeult?
Guess it's because nothing got assingned eh?
Re: How to transfer value to iframe? [message #183131 is a reply to message #183130] Thu, 10 October 2013 05:10 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 10/10/13 06:51, richard wrote:
> On Thu, 10 Oct 2013 15:40:55 +1100, Jeff North wrote:
>
>> On Thu, 10 Oct 2013 00:01:56 -0400, in comp.lang.php richard
>> <noreply(at)example(dot)com>
>> <1072h1gn3qh4z(dot)axclc9ryd5s7$(dot)dlg(at)40tude(dot)net> wrote:
>>
>>> | On Thu, 10 Oct 2013 14:20:56 +1030, David Robley wrote:
>>> |
>>> | > richard wrote:
>>> | >
>>> | >> On Thu, 10 Oct 2013 13:43:42 +1030, David Robley wrote:
>>> | >>
>>> | >>> richard wrote:
>>> | >>>
>>> | >>>> http://mroldies.net/200/audiox.php
>>> | >>>>
>>> | >>>> First, the sound will work only in firefox.
>>> | >>>> So don't go bashing me for that.
>>> | >>>>
>>> | >>>> I have it set up so that a shuffled array will be displayed any time the
>>> | >>>> page is loaded. Hopefully.
>>> | >>>> What I want to do is to ensure that item one in the menu list will match
>>> | >>>> what is in the iframe.
>>> | >>>>
>>> | >>>> $_get[] relies on the values being transferred via a link.
>>> | >>>
>>> | >>> Not so - it uses the query string -
>>> | >>> https://en.wikipedia.org/wiki/Query_string - which may be passed via a
>>> | >>> clickable link, or as part of a URL
>>> | >>>
>>> | >>>> At this point, no link has been clicked on to set the value.
>>> | >>>> So how do I properly set the intitial value?
>>> | >>>
>>> | >>> <iframe id="x1" src="audiox1.php?a=foo&b=bar&c=baz"
>>> | >>> name="alpha"></iframe>
>>> | >>>
>>> | >>> Simply pass the value(s) you need to utilise in the iframe
>>> | >>
>>> | >> I tried this
>>> | >>
>>> | >> <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
>>> | >>
>>> | >>
>>> | >> Assigining songid as $songid=$play[0];
>>> | >>
>>> | >> Retrieving value through
>>> | >>
>>> | >>
>>> | >> $number=$_GET["asong"];
>>> | >>
>>> | >> echo $number;
>>> | >>
>>> | >>
>>> | >>
>>> | >> Results in "songid" being printed.
>>> | >
>>> | > Not surprisingly, because that is what you have set as the value for asong
>>> | > in the iframe link. If you want to pass a value contained in a variable, you
>>> | > should use the variable, not a string. Look closely at what you are doing
>>> | > when calling the iframe.
>>> | >
>>> | > <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>
>>> |
>>> | so my question kind of still stands.
>>> | how do I make asong=?????? as the given initial value of the shuffled
>>> | array?
>>
>> Shhheeeeesssshhh.
>> <iframe id="x1" src="audiox1.php?asong="+songid name="alpha"></iframe>
>
> Wonder why I get absolutely nothing as a reeult?
> Guess it's because nothing got assingned eh?
>

If you copied the example as it was, you never get a value passed to the
frame, if you did make it as you should for appending a php value, then
the problem is that you haven't assigned a value.

Maybe something like http://www.w3schools.com/php could help you on the
way with the simple things.

--

//Aho
Re: How to transfer value to iframe? [message #183133 is a reply to message #183123] Thu, 10 October 2013 13:12 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Wed, 09 Oct 2013 22:32:22 -0400, richard wrote:

> So how do I properly set the intitial value?

That's up to you. How you choose default values to display when the page
is first loaded is always up to the developer.

However, if you have a consistency rule, it's probably best to ensure it
applies to the initial defaults as well as subsequent page loads.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: How to transfer value to iframe? [message #183134 is a reply to message #183125] Thu, 10 October 2013 13:25 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Wed, 09 Oct 2013 23:31:55 -0400, richard wrote:

> I tried this

> <iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>

> Assigining songid as $songid=$play[0];

> Retrieving value through

> $number=$_GET["asong"];

> echo $number;

> Results in "songid" being printed.

That is as expected, you're setting the value of asong in the query
string to the text value songid.

Depending on how you're generating the string:

<iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>

and assuming that $songid is a php variable containing the numeric songid
that you want to pass, you may wish to replace songid in the above
construction with one of:

' . $songid . '
$songid
{$songid}

I also suggest that you read

http://www.php.net/manual/en/language.types.string.php

very carefully. There are some very important comments there about what
happens inside different types of string literal depending on the quoting
methods used.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
resolved?? Re: How to transfer value to iframe? (was: How to transfer value to iframe?) [message #183138 is a reply to message #183123] Thu, 10 October 2013 17:01 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:

> http://mroldies.net/200/audiox.php
>
> First, the sound will work only in firefox.
> So don't go bashing me for that.


<?php
$number=$numbers[0];
echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
name="alpha"></iframe>';
?>

At least the first number is now displayed.
Re: resolved?? Re: How to transfer value to iframe? [message #183139 is a reply to message #183138] Thu, 10 October 2013 17:28 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Thu, 10 Oct 2013 13:01:51 -0400, richard wrote:

> On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>
>> http://mroldies.net/200/audiox.php
>>
>> First, the sound will work only in firefox.
>> So don't go bashing me for that.
>
>
> <?php
> $number=$numbers[0];
> echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
> name="alpha"></iframe>';
> ?>
>
> At least the first number is now displayed.

works just fine.
www.mroldies.net/200.audiox.php
Re: resolved?? Re: How to transfer value to iframe? [message #183140 is a reply to message #183139] Thu, 10 October 2013 17:39 Go to previous messageGo to next message
Derek Turner is currently offline  Derek Turner
Messages: 48
Registered: October 2010
Karma: 0
Member
On Thu, 10 Oct 2013 13:28:30 -0400, richard wrote:

> works just fine. www.mroldies.net/200.audiox.php

apart from the 404 error, you mean?
Re: resolved?? Re: How to transfer value to iframe? [message #183143 is a reply to message #183140] Thu, 10 October 2013 19:47 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On 10 Oct 2013 17:39:20 GMT, Derek Turner wrote:

> On Thu, 10 Oct 2013 13:28:30 -0400, richard wrote:
>
>> works just fine. www.mroldies.net/200.audiox.php
>
> apart from the 404 error, you mean?

Yep. you don't know how to correct the obvious mistake?
www.mroldies.net/200/audiox.php
Re: resolved?? Re: How to transfer value to iframe? [message #183148 is a reply to message #183143] Thu, 10 October 2013 21:31 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Thu, 10 Oct 2013 15:47:32 -0400, richard wrote:

> :20 GMT, Derek Turner wrote:

>> richard wrote:

>>> www.mroldies.net/200.audiox.php

>> apart from the 404 error, you mean?

> Yep. you don't know how to correct the obvious mistake?
> www.mroldies.net/200/audiox.php

You may believe that the mistake was obvious, but you posted a valid url
to a non existent document. In such cases there is no "obvious" fix.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: resolved?? Re: How to transfer value to iframe? [message #183150 is a reply to message #183138] Thu, 10 October 2013 22:13 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 10/10/2013 01:01 PM, richard wrote:
> On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>
>> http://mroldies.net/200/audiox.php
>>
>> First, the sound will work only in firefox.
>> So don't go bashing me for that.
>
>
> <?php
> $number=$numbers[0];
> echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
> name="alpha"></iframe>';
> ?>
>
> At least the first number is now displayed.
>

echo "<iframe id=x1 src='audiox1.php?asong=$number&name=$alpha'></iframe>";


No need to quote the *values*, they are sent as text. Not sure what
you're doing with -alpha-, I assume it is a variable as well...

--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: How to transfer value to iframe? [message #183151 is a reply to message #183129] Thu, 10 October 2013 23:15 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Jeff North wrote:

> On Thu, 10 Oct 2013 00:01:56 -0400, in comp.lang.php richard
>> | so my question kind of still stands.
>> | how do I make asong=?????? as the given initial value of the shuffled
>> | array?
>
> Shhheeeeesssshhh.
> <iframe id="x1" src="audiox1.php?asong="+songid name="alpha"></iframe>

Sorry, HTML6, which introduces variables, is not widely supported yet.


PointedEars
--
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
-- Richard Cornford, comp.lang.javascript, 2011-11-14
Re: resolved?? Re: How to transfer value to iframe? [message #183152 is a reply to message #183150] Thu, 10 October 2013 23:37 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Norman Peelman wrote:

> On 10/10/2013 01:01 PM, richard wrote:
>> On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>>> http://mroldies.net/200/audiox.php
>>>
>>> First, the sound will work only in firefox.
>>> So don't go bashing me for that.
>>
>>
>> <?php
>> $number=$numbers[0];
>> echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
>> name="alpha"></iframe>';
>> ?>
>>
>> At least the first number is now displayed.
>
> echo "<iframe id=x1
> src='audiox1.php?asong=$number&name=$alpha'></iframe>";

The safe syntax is

echo "<iframe id=x1
src='audiox1.php?asong={$number}&name={$alpha}'></iframe>";

> No need to quote the *values*, they are sent as text.

Utter nonsense. Depending on the version of HTML and the attribute value,
attribute values MUST be quoted. The safe approach is to *always* quote
attribute values, it certainly is when attribute values or parts of those
are generated like here. Since double-quoting is more common than single-
quoting, double-quoting as it was done by the OP actually is the safe
approach.

You might have misread the original code, which is actually equivalent to

echo '<iframe id="x1" src="audiox1.php?asong='
. $number
. '" name="alpha"></iframe>';

if we assume that the line-break after “$number.'"” was accidental
originally or was inserted when you quoted the original code.

In particular, in your code the value of $alpha must be *URI-encoded* or the
URI-reference that is the attribute value is invalid or the entire HTML
fragment could become invalid (or code-injected) if $alpha contains space or
special characters. Other generated attribute values, unless it is certain
that code injection is impossible (for example with int values), SHOULD be
htmlspecialchars()'d.

> Not sure what you're doing with -alpha-, I assume it is a variable as
> well...

Does it look like one? RTFM.


PointedEars
--
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
-- Richard Cornford, comp.lang.javascript, 2011-11-14
Re: resolved?? Re: How to transfer value to iframe? [message #183153 is a reply to message #183150] Thu, 10 October 2013 23:43 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Thu, 10 Oct 2013 18:13:30 -0400, Norman Peelman wrote:

> On 10/10/2013 01:01 PM, richard wrote:
>> On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>>
>>> http://mroldies.net/200/audiox.php
>>>
>>> First, the sound will work only in firefox.
>>> So don't go bashing me for that.
>>
>>
>> <?php
>> $number=$numbers[0];
>> echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
>> name="alpha"></iframe>';
>> ?>
>>
>> At least the first number is now displayed.
>>
>
> echo "<iframe id=x1 src='audiox1.php?asong=$number&name=$alpha'></iframe>";
>
>
> No need to quote the *values*, they are sent as text. Not sure what
> you're doing with -alpha-, I assume it is a variable as well...

BULLSHIT!
target="alpha" is a valid attribute, it is not a value.
And there is no $ needed in the values section.
Re: resolved?? Re: How to transfer value to iframe? [message #183154 is a reply to message #183148] Thu, 10 October 2013 23:45 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Thu, 10 Oct 2013 21:31:13 +0000 (UTC), Denis McMahon wrote:

> On Thu, 10 Oct 2013 15:47:32 -0400, richard wrote:
>
>> :20 GMT, Derek Turner wrote:
>
>>> richard wrote:
>
>>>> www.mroldies.net/200.audiox.php
>
>>> apart from the 404 error, you mean?
>
>> Yep. you don't know how to correct the obvious mistake?
>> www.mroldies.net/200/audiox.php
>
> You may believe that the mistake was obvious, but you posted a valid url
> to a non existent document. In such cases there is no "obvious" fix.

www.shut.the.fuk.up.stu.pid
is a valid link as well.
if it does not exist, you get an error.
Re: resolved?? Re: How to transfer value to iframe? [message #183155 is a reply to message #183152] Thu, 10 October 2013 23:51 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Thomas 'PointedEars' Lahn wrote:

> Norman Peelman wrote:
>> On 10/10/2013 01:01 PM, richard wrote:
>>> On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>>>> http://mroldies.net/200/audiox.php
>>>>
>>>> First, the sound will work only in firefox.
>>>> So don't go bashing me for that.
>>>
>>>
>>> <?php
>>> $number=$numbers[0];
>>> echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
>>> name="alpha"></iframe>';
>>> ?>
>>>
>>> At least the first number is now displayed.
>>
>> echo "<iframe id=x1
>> src='audiox1.php?asong=$number&name=$alpha'></iframe>";
>
> The safe syntax is
>
> echo "<iframe id=x1
> src='audiox1.php?asong={$number}&name={$alpha}'></iframe>";

Actually, that is the safe *PHP* syntax (after the line-break is removed).
HTML requires another change:

echo "<iframe id=x1"
. " src='audiox1.php?asong={$number}&amp;name={$alpha}'></iframe>";

AISB, conversion of ”&” to “&amp;” or &#38; can and should be done with
PHP's htmlentities() or htmlspecialchars(), respectively. And “echo” should
not be used like above, but like below:

<iframe id="x1" src="audiox1.php?asong=<?php echo $number;
?>&amp;name=<?php echo htmlspecialchars($alpha); ?>"></iframe>

PHP 5.4 and PHP < 5.4 with corresponding php.ini configuration support

<iframe id="x1" src="audiox1.php?asong=<?= $number ?>&amp;name=<?=
htmlspecialchars($alpha) ?>"></iframe>

and

<iframe id="x1" src="audiox1.php?asong=<%= $number %>&amp;name=<%=
htmlspecialchars($alpha) %>"></iframe>

respectively. Usually you would use a template engine or the MVC pattern:

<iframe id="x1"
src="audiox1.php?asong=<?= $this->number ?>&amp;name=<?=
$this->escape($this->alpha) ?>"></iframe>

This is explained and recommended in the first chapter of the PHP manual.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Re: resolved?? Re: How to transfer value to iframe? [message #183158 is a reply to message #183154] Fri, 11 October 2013 00:45 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 11/10/13 00:45, richard wrote:
> On Thu, 10 Oct 2013 21:31:13 +0000 (UTC), Denis McMahon wrote:
>
>> On Thu, 10 Oct 2013 15:47:32 -0400, richard wrote:
>>
>>> :20 GMT, Derek Turner wrote:
>>
>>>> richard wrote:
>>
>>>> > www.mroldies.net/200.audiox.php
>>
>>>> apart from the 404 error, you mean?
>>
>>> Yep. you don't know how to correct the obvious mistake?
>>> www.mroldies.net/200/audiox.php
>>
>> You may believe that the mistake was obvious, but you posted a valid url
>> to a non existent document. In such cases there is no "obvious" fix.
>
> www.shut.the.fuk.up.stu.pid
> is a valid link as well.
> if it does not exist, you get an error.
>
not a 404 error though....

--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: resolved?? Re: How to transfer value to iframe? [message #183160 is a reply to message #183143] Fri, 11 October 2013 01:13 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
richard wrote:

> On 10 Oct 2013 17:39:20 GMT, Derek Turner wrote:
>
>> On Thu, 10 Oct 2013 13:28:30 -0400, richard wrote:
>>
>>> works just fine. www.mroldies.net/200.audiox.php
>>
>> apart from the 404 error, you mean?
>
> Yep. you don't know how to correct the obvious mistake?
> www.mroldies.net/200/audiox.php

That is just golden, considering who wrote it :-)
--
Cheers
David Robley

Why can't we just spell it orderves?
Re: resolved?? Re: How to transfer value to iframe? [message #183162 is a reply to message #183138] Fri, 11 October 2013 11:05 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Norman Peelman wrote:

> On 10/10/2013 07:43 PM, richard wrote:
>> On Thu, 10 Oct 2013 18:13:30 -0400, Norman Peelman wrote:
>>> On 10/10/2013 01:01 PM, richard wrote:
>>>> On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>>>> > http://mroldies.net/200/audiox.php
>>>> >
>>>> > First, the sound will work only in firefox.
>>>> > So don't go bashing me for that.
>>>>
>>>> <?php
>>>> $number=$numbers[0];
>>>> echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
>>>> name="alpha"></iframe>';
>>>> ?>
>>>> […]
>>> No need to quote the *values*, they are sent as text. Not sure what
>>> you're doing with -alpha-, I assume it is a variable as well...
>>
>> BULLSHIT!
>> target="alpha" is a valid attribute, it is not a value.

It is a Valid attribute with a value specified.

>> And there is no $ needed in the values section.

What is the “values section”?

> What in the world are you talking about? This has nothing to do with
> the -target- attribute. You said 'At least the first number is now
> displayed.' so I thought you would eventually substitute "alpha" with
> some variable content so I suggested it that way, also fixing your URL
> by adding the '&' between them.

You would use “target="alpha"” to display the result of navigation or form
submission in an “iframe” element with “name="alpha"” instead of the source
window, as the OP apparently intended. ISTM you need to brush up on your
HTML knowledge quite a bit.

< http://www.w3.org/TR/2012/CR-html5-20121217/links.html#attr-hyperlink-targe t>
<http://www.w3.org/TR/2012/CR-html5-20121217/forms.html#attr-fs-target>
< http://www.w3.org/TR/2012/CR-html5-20121217/embedded-content-0.html#attr-if rame-name>


PointedEars
--
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
-- Richard Cornford, comp.lang.javascript, 2011-11-14
Re: resolved?? Re: How to transfer value to iframe? [message #183163 is a reply to message #183153] Fri, 11 October 2013 02:30 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 10/10/2013 07:43 PM, richard wrote:
> On Thu, 10 Oct 2013 18:13:30 -0400, Norman Peelman wrote:
>
>> On 10/10/2013 01:01 PM, richard wrote:
>>> On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>>>
>>>> http://mroldies.net/200/audiox.php
>>>>
>>>> First, the sound will work only in firefox.
>>>> So don't go bashing me for that.
>>>
>>>
>>> <?php
>>> $number=$numbers[0];
>>> echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
>>> name="alpha"></iframe>';
>>> ?>
>>>
>>> At least the first number is now displayed.
>>>
>>
>> echo "<iframe id=x1 src='audiox1.php?asong=$number&name=$alpha'></iframe>";
>>
>>
>> No need to quote the *values*, they are sent as text. Not sure what
>> you're doing with -alpha-, I assume it is a variable as well...
>
> BULLSHIT!
> target="alpha" is a valid attribute, it is not a value.
> And there is no $ needed in the values section.
>

What in the world are you talking about? This has nothing to do with
the -target- attribute. You said 'At least the first number is now
displayed.' so I thought you would eventually substitute "alpha" with
some variable content so I suggested it that way, also fixing your URL
by adding the '&' between them.

--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: resolved?? Re: How to transfer value to iframe? [message #183173 is a reply to message #183154] Fri, 11 October 2013 15:17 Go to previous messageGo to next message
Evan Platt is currently offline  Evan Platt
Messages: 124
Registered: November 2010
Karma: 0
Senior Member
On Thu, 10 Oct 2013 19:45:53 -0400, richard <noreply(at)example(dot)com>
wrote:

> www.shut.the.fuk.up.stu.pid
> is a valid link as well.
> if it does not exist, you get an error.

And you wonder why no one ever wants to help you?

You're so fscking st00pid you can't even cut and paste properly. LOL.
--
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
Re: resolved?? Re: How to transfer value to iframe? [message #183175 is a reply to message #183154] Fri, 11 October 2013 15:27 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Thu, 10 Oct 2013 19:45:53 -0400, richard wrote:

> On Thu, 10 Oct 2013 21:31:13 +0000 (UTC), Denis McMahon wrote:
>
>> On Thu, 10 Oct 2013 15:47:32 -0400, richard wrote:
>>
>>> :20 GMT, Derek Turner wrote:
>>
>>>> richard wrote:
>>
>>>> > www.mroldies.net/200.audiox.php
>>
>>>> apart from the 404 error, you mean?
>>
>>> Yep. you don't know how to correct the obvious mistake?
>>> www.mroldies.net/200/audiox.php
>>
>> You may believe that the mistake was obvious, but you posted a valid
>> url to a non existent document. In such cases there is no "obvious"
>> fix.
>
> www.shut.the.fuk.up.stu.pid is a valid link as well.
> if it does not exist, you get an error.

Ok, you're such an expert at fixing such obvious mistakes, what's the
correct url given that the following url gives a 404:

http://www.sined.co.uk/sined/m.use.html

Prove your answer is correct by telling us what appears at the correct
url.

Explain what makes the "obvious" answer so "obvious".

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: resolved?? Re: How to transfer value to iframe? [message #183176 is a reply to message #183163] Fri, 11 October 2013 15:39 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Thu, 10 Oct 2013 22:30:43 -0400, Norman Peelman wrote:

> On 10/10/2013 07:43 PM, richard wrote:
>> On Thu, 10 Oct 2013 18:13:30 -0400, Norman Peelman wrote:
>>
>>> On 10/10/2013 01:01 PM, richard wrote:
>>>> On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>>>>
>>>> > http://mroldies.net/200/audiox.php
>>>> >
>>>> > First, the sound will work only in firefox.
>>>> > So don't go bashing me for that.
>>>>
>>>>
>>>> <?php $number=$numbers[0];
>>>> echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
>>>> name="alpha"></iframe>';
>>>> ?>
>>>>
>>>> At least the first number is now displayed.
>>>>
>>>>
>>> echo "<iframe id=x1
>>> src='audiox1.php?asong=$number&name=$alpha'></iframe>";
>>>
>>>
>>> No need to quote the *values*, they are sent as text. Not sure what
>>> you're doing with -alpha-, I assume it is a variable as well...
>>
>> BULLSHIT!
>> target="alpha" is a valid attribute, it is not a value. And there is no
>> $ needed in the values section.
>>
>>
> What in the world are you talking about? This has nothing to do with
> the -target- attribute. You said 'At least the first number is now
> displayed.' so I thought you would eventually substitute "alpha" with
> some variable content so I suggested it that way, also fixing your URL
> by adding the '&' between them.

Norman, you've become confused by Richard's string quoting.

His php strings are single quoted and he uses double quotes for his html.

This means that php variable translation does not take place in the
strings.

In his initial example, name="alpha" was an attribute of the iframe, not
part of the query string of the src url.

This is why he has to replace songid with

'.$songid.'

instead of

$songid

Initially he said he was using this:

<iframe id="x1" src="audiox1.php?asong=songid" name="alpha"></iframe>

But he typically omitted to tell us whether this was in a heredoc or echo
with single quoted strings (or even a nowdoc).

In a heredoc, he could use $songid ( or even {$songid} ) but if it was an
echo with single quotes, he would need to use '.$songid.'

Subsequently he said '.$songid.' worked, so I deduce backwards from that
that richard was using single quoted php string with echo.

This is an example of classic richard, he feeds you half the problem and
the nature of the original problem only becomes clear after you've solved
for all possible variations and he's picked the solution that works. It
would be so much easier if he would learn to ask the right question, but
that's probably a lost cause now.

Mind you, I suspect so is his website. I still haven't worked out what
niche he expects to fill that isn't already fully covered by a
combination of you tube and wikipedia.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: resolved?? Re: How to transfer value to iframe? [message #183189 is a reply to message #183176] Fri, 11 October 2013 23:04 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 10/11/2013 11:39 AM, Denis McMahon wrote:
> On Thu, 10 Oct 2013 22:30:43 -0400, Norman Peelman wrote:
>
>> On 10/10/2013 07:43 PM, richard wrote:
>>> On Thu, 10 Oct 2013 18:13:30 -0400, Norman Peelman wrote:
>>>
>>>> On 10/10/2013 01:01 PM, richard wrote:
>>>> > On Wed, 9 Oct 2013 22:32:22 -0400, richard wrote:
>>>> >
>>>> >> http://mroldies.net/200/audiox.php
>>>> >>
>>>> >> First, the sound will work only in firefox.
>>>> >> So don't go bashing me for that.
>>>> >
>>>> >
>>>> > <?php $number=$numbers[0];
>>>> > echo '<iframe id="x1" src="audiox1.php?asong='.$number.'"
>>>> > name="alpha"></iframe>';
>>>> > ?>
>>>> >
>>>> > At least the first number is now displayed.
>>>> >
>>>> >
>>>> echo "<iframe id=x1
>>>> src='audiox1.php?asong=$number&name=$alpha'></iframe>";
>>>>
>>>>
>>>> No need to quote the *values*, they are sent as text. Not sure what
>>>> you're doing with -alpha-, I assume it is a variable as well...
>>>
>>> BULLSHIT!
>>> target="alpha" is a valid attribute, it is not a value. And there is no
>>> $ needed in the values section.
>>>
>>>
>> What in the world are you talking about? This has nothing to do with
>> the -target- attribute. You said 'At least the first number is now
>> displayed.' so I thought you would eventually substitute "alpha" with
>> some variable content so I suggested it that way, also fixing your URL
>> by adding the '&' between them.
>
> Norman, you've become confused by Richard's string quoting.
>
> His php strings are single quoted and he uses double quotes for his html.
>
> This means that php variable translation does not take place in the
> strings.
>
> In his initial example, name="alpha" was an attribute of the iframe, not
> part of the query string of the src url.
>

Yes, I actually see that now, but then again I usually keep my -id-
and -name- attributes together at the beginning of a tag. Is it required
no, but it sure does make for a bit of consistency when I'm looking for
bugs in the same typical places for the same types of data. It was a
misunderstanding on my part. As a general rule I shy away from doing a
lot of concatenation and "\" escaping as much as I possibly can. I also
try to sway others from it as well but, to each their own. It makes code
painful to debug.

--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: resolved?? Re: How to transfer value to iframe? [message #183199 is a reply to message #183175] Sat, 12 October 2013 04:21 Go to previous message
Evan Platt is currently offline  Evan Platt
Messages: 124
Registered: November 2010
Karma: 0
Senior Member
On Fri, 11 Oct 2013 15:27:08 +0000 (UTC), Denis McMahon
<denismfmcmahon(at)gmail(dot)com> wrote:

> Ok, you're such an expert at fixing such obvious mistakes, what's the
> correct url given that the following url gives a 404:
>
> http://www.sined.co.uk/sined/m.use.html
>
> Prove your answer is correct by telling us what appears at the correct
> url.
>
> Explain what makes the "obvious" answer so "obvious".

Unless you have a death wish, I wouldn't hold your breath.This is the
point where bullis realizes he's wrong and gives up and crawls back
under his bridge.
--
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: please unsubscribe me
Next Topic: Can't change upload_max_filesize
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 22:01:52 GMT 2024

Total time taken to generate the page: 0.02586 seconds