Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11333 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2013-10-09 22:32 -0400 |
| Last post | 2013-10-11 19:04 -0400 |
| Articles | 10 on this page of 30 — 10 participants |
Back to article view | Back to comp.lang.php
How to transfer value to iframe? richard <noreply@example.com> - 2013-10-09 22:32 -0400
Re: How to transfer value to iframe? David Robley <me@home.invalid> - 2013-10-10 13:43 +1030
Re: How to transfer value to iframe? richard <noreply@example.com> - 2013-10-09 23:31 -0400
Re: How to transfer value to iframe? David Robley <me@home.invalid> - 2013-10-10 14:20 +1030
Re: How to transfer value to iframe? richard <noreply@example.com> - 2013-10-10 00:01 -0400
Re: How to transfer value to iframe? Jeff North <jnorthau@yahoo.com.au> - 2013-10-10 15:40 +1100
Re: How to transfer value to iframe? richard <noreply@example.com> - 2013-10-10 00:51 -0400
Re: How to transfer value to iframe? "J.O. Aho" <user@example.net> - 2013-10-10 07:10 +0200
Re: How to transfer value to iframe? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-11 01:15 +0200
Re: How to transfer value to iframe? Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-10 13:25 +0000
Re: How to transfer value to iframe? Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-10 13:12 +0000
resolved?? Re: How to transfer value to iframe? (was: How to transfer value to iframe?) richard <noreply@example.com> - 2013-10-10 13:01 -0400
Re: resolved?? Re: How to transfer value to iframe? richard <noreply@example.com> - 2013-10-10 13:28 -0400
Re: resolved?? Re: How to transfer value to iframe? Derek Turner <frderek@cesmail.net> - 2013-10-10 17:39 +0000
Re: resolved?? Re: How to transfer value to iframe? richard <noreply@example.com> - 2013-10-10 15:47 -0400
Re: resolved?? Re: How to transfer value to iframe? Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-10 21:31 +0000
Re: resolved?? Re: How to transfer value to iframe? richard <noreply@example.com> - 2013-10-10 19:45 -0400
Re: resolved?? Re: How to transfer value to iframe? The Natural Philosopher <tnp@invalid.invalid> - 2013-10-11 01:45 +0100
Re: resolved?? Re: How to transfer value to iframe? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2013-10-11 08:17 -0700
Re: resolved?? Re: How to transfer value to iframe? Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-11 15:27 +0000
Re: resolved?? Re: How to transfer value to iframe? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2013-10-11 21:21 -0700
Re: resolved?? Re: How to transfer value to iframe? David Robley <me@home.invalid> - 2013-10-11 11:43 +1030
Re: resolved?? Re: How to transfer value to iframe? Norman Peelman <npeelman@cfl.rr.com> - 2013-10-10 18:13 -0400
Re: resolved?? Re: How to transfer value to iframe? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-11 01:37 +0200
Re: resolved?? Re: How to transfer value to iframe? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-11 01:51 +0200
Re: resolved?? Re: How to transfer value to iframe? richard <noreply@example.com> - 2013-10-10 19:43 -0400
Re: resolved?? Re: How to transfer value to iframe? Norman Peelman <npeelman@cfl.rr.com> - 2013-10-10 22:30 -0400
Re: resolved?? Re: How to transfer value to iframe? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-11 13:05 +0200
Re: resolved?? Re: How to transfer value to iframe? Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-11 15:39 +0000
Re: resolved?? Re: How to transfer value to iframe? Norman Peelman <npeelman@cfl.rr.com> - 2013-10-11 19:04 -0400
Page 2 of 2 — ← Prev page 1 [2]
| From | Evan Platt <evan@theobvious.espphotography.com.invalid> |
|---|---|
| Date | 2013-10-11 21:21 -0700 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <8hjh59tr9goisjffs6orq8merflv6u9292@4ax.com> |
| In reply to | #11379 |
On Fri, 11 Oct 2013 15:27:08 +0000 (UTC), Denis McMahon <denismfmcmahon@gmail.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.
[toc] | [prev] | [next] | [standalone]
| From | David Robley <me@home.invalid> |
|---|---|
| Date | 2013-10-11 11:43 +1030 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <l37j87$6uj$1@news.albasani.net> |
| In reply to | #11348 |
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?
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-10-10 18:13 -0400 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <l378qb$r9n$1@dont-email.me> |
| In reply to | #11345 |
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?-
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-10-11 01:37 +0200 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <3866294.L8KrQWI3Da@PointedEars.de> |
| In reply to | #11354 |
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
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-10-11 01:51 +0200 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <9534732.tJzfvtEYAU@PointedEars.de> |
| In reply to | #11356 |
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}&name={$alpha}'></iframe>";
AISB, conversion of ”&” to “&” or & 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;
?>&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 ?>&name=<?=
htmlspecialchars($alpha) ?>"></iframe>
and
<iframe id="x1" src="audiox1.php?asong=<%= $number %>&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 ?>&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
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-10-10 19:43 -0400 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <akfd5hqjwt40.p3l5x03dp9av.dlg@40tude.net> |
| In reply to | #11354 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-10-10 22:30 -0400 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <l37nsk$qjg$1@dont-email.me> |
| In reply to | #11357 |
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?-
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-10-11 13:05 +0200 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <2166079.R6AA9dKiHs@PointedEars.de> |
| In reply to | #11365 |
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-target> <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-iframe-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
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-10-11 15:39 +0000 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <l3963e$hql$3@dont-email.me> |
| In reply to | #11365 |
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@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-10-11 19:04 -0400 |
| Subject | Re: resolved?? Re: How to transfer value to iframe? |
| Message-ID | <l3a05m$omf$1@dont-email.me> |
| In reply to | #11380 |
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?-
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.php
csiph-web