Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11755 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2013-11-07 13:06 -0500 |
| Last post | 2013-11-08 08:33 +0100 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.lang.php
values won't transfer richard <noreply@example.com> - 2013-11-07 13:06 -0500
Re: values won't transfer Tim Streater <timstreater@greenbee.net> - 2013-11-07 18:56 +0000
Re: values won't transfer Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-07 19:58 +0000
Re: values won't transfer richard <noreply@example.com> - 2013-11-07 15:37 -0500
Re: values won't transfer Arno Welzel <usenet@arnowelzel.de> - 2013-11-07 22:01 +0100
Re: values won't transfer richard <noreply@example.com> - 2013-11-07 16:29 -0500
Re: values won't transfer Arno Welzel <usenet@arnowelzel.de> - 2013-11-08 08:33 +0100
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-11-07 13:06 -0500 |
| Subject | values won't transfer |
| Message-ID | <e2vbaluuftp4$.48nrw7i8j930.dlg@40tude.net> |
www.mroldies.net/index.php
this is not the same page as the home page as that is still active for the
moment.
I am trying to pass the value in the url to the iframe.
No matter what I try, it won't.
I had to use the \" in order for the link to show properly.
The iframe is named "show".
My thinking is that the javascript has somehow destroyed that.
Queswtion is, how do I make it work so that the value "tune" will pass
properly?
<div style="float:left; width:5in; height:6in; overflow:auto;
border:solid 2px #00ff00; padding:10px;">
<ol>
<?php
$numbers=range(1,200);
shuffle($numbers);
foreach($numbers as $play) {
$htp="http://mroldies.net/index.php?tune=".$play." target=\"show\"";
echo "<li>";
$asong=$playme[$play][4];
echo "<a class='aplay' href='".$htp."'
data-src='http://mroldies.net/200/";
echo $asong;
echo ".mp3'>";
echo $playme[$play][2]." - ".$playme[$play][0]." #
".$playme[$play][1];
echo "<br>";
echo $playme[$play][3];
echo "</a>";
echo "</li>\n";
}
?>
</ol>
</div>
[toc] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-11-07 18:56 +0000 |
| Message-ID | <071120131856545872%timstreater@greenbee.net> |
| In reply to | #11755 |
In article <e2vbaluuftp4$.48nrw7i8j930.dlg@40tude.net>, richard
<noreply@example.com> wrote:
> www.mroldies.net/index.php
>
> this is not the same page as the home page as that is still active for the
> moment.
But you reference that in your code below. So that is what will be
used, not some other version.
> I am trying to pass the value in the url to the iframe.
> No matter what I try, it won't.
> I had to use the \" in order for the link to show properly.
> The iframe is named "show".
>
> My thinking is that the javascript has somehow destroyed that.
What javascript? You haven't shown any.
> Question is, how do I make it work so that the value "tune" will pass
> properly?
>
>
>
>
>
>
> <div style="float:left; width:5in; height:6in; overflow:auto;
> border:solid 2px #00ff00; padding:10px;">
> <ol>
> <?php
> $numbers=range(1,200);
> shuffle($numbers);
>
> foreach($numbers as $play) {
>
> $htp="http://mroldies.net/index.php?tune=".$play." target=\"show\"";
>
> echo "<li>";
> $asong=$playme[$play][4];
> echo "<a class='aplay' href='".$htp."'
> data-src='http://mroldies.net/200/";
> echo $asong;
> echo ".mp3'>";
> echo $playme[$play][2]." - ".$playme[$play][0]." #
> ".$playme[$play][1];
> echo "<br>";
> echo $playme[$play][3];
> echo "</a>";
>
> echo "</li>\n";
> }
>
> ?>
> </ol>
> </div>
Is the above part of your new mroldies.net file? If so, why are you
loading another copy of it into an iframe within it? And otherwise,
what are you doing inside the iframe to try to obtain the value of
tune?
The above didn't load anything into the iframe when I tried it; I
haven't looked into why. Personally I use open(), write(), and close()
to write an html string into an iframe, which may not be the best way
to do it but works well enough for me.
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2013-11-07 19:58 +0000 |
| Message-ID | <0.87dda07a0cfaaeb46297.20131107195820GMT.87eh6svvab.fsf@bsb.me.uk> |
| In reply to | #11755 |
richard <noreply@example.com> writes: <snip> > I am trying to pass the value in the url to the iframe. > No matter what I try, it won't. > I had to use the \" in order for the link to show properly. > The iframe is named "show". You quoting is wrong. In general, if you don't know exactly why you needed some construct such as the \", it's better to go a read up on that area. It's almost impossible to program by trial and error. > My thinking is that the javascript has somehow destroyed that. I think your question is purely a PHP one, so I've set followups accordingly. > Queswtion is, how do I make it work so that the value "tune" will pass > properly? <snip> > $htp="http://mroldies.net/index.php?tune=".$play." target=\"show\""; <snip> > echo "<a class='aplay' href='".$htp."' <snip> If $play is, say, 42, the result of this will be: <a class='aplay' href='http://mroldies.net/index.php?tune=42 target="show"' Can you see how the show attribute is incorrectly inside the single-quoted href attribute? -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-11-07 15:37 -0500 |
| Message-ID | <1qj6lkbgiww2q.kj3axstv2x28.dlg@40tude.net> |
| In reply to | #11757 |
On Thu, 07 Nov 2013 19:58:20 +0000, Ben Bacarisse wrote: > richard <noreply@example.com> writes: > <snip> >> I am trying to pass the value in the url to the iframe. >> No matter what I try, it won't. >> I had to use the \" in order for the link to show properly. >> The iframe is named "show". > > You quoting is wrong. In general, if you don't know exactly why you > needed some construct such as the \", it's better to go a read up on > that area. It's almost impossible to program by trial and error. > >> My thinking is that the javascript has somehow destroyed that. > > I think your question is purely a PHP one, so I've set followups > accordingly. > >> Queswtion is, how do I make it work so that the value "tune" will pass >> properly? > <snip> >> $htp="http://mroldies.net/index.php?tune=".$play." target=\"show\""; > <snip> >> echo "<a class='aplay' href='".$htp."' > <snip> > > If $play is, say, 42, the result of this will be: > > <a class='aplay' href='http://mroldies.net/index.php?tune=42 target="show"' > > Can you see how the show attribute is incorrectly inside the > single-quoted href attribute? Thanks for the fresh eyes. I had overlooked the closing quote and couldn't understand why target="show" was showing up in the url. Now I do.
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2013-11-07 22:01 +0100 |
| Message-ID | <527BFF96.2070809@arnowelzel.de> |
| In reply to | #11755 |
richard, 2013-11-07 19:06:
>
> www.mroldies.net/index.php
>
> this is not the same page as the home page as that is still active for the
> moment.
>
> I am trying to pass the value in the url to the iframe.
> No matter what I try, it won't.
> I had to use the \" in order for the link to show properly.
Yes - because the string is already delimited with double quotes.
> The iframe is named "show".
>
> My thinking is that the javascript has somehow destroyed that.
What JavaScript? There is no JavaScript in the code you present here.
> Queswtion is, how do I make it work so that the value "tune" will pass
> properly?
Don't put target="show" inside the href attribute. Check the created
HTML - you will hopefully see the error.
You define $htp as:
$htp="http://mroldies.net/index.php?tune=".$play." target=\"show\"";
But then you write:
echo "<a class='aplay' href='".$htp."' ...
So - expand this - it will become:
<a class='aplay'
href='http://mroldies.net/index.php?tune=$play target="show"'
Try to think about the problem - step by step. And not just put together
a bunch of code without caring for details!
If you put just the anchor attributes line by line the code also becomes
much easier to read. Also note that you can enclose double quotes in
single quotes (and vice versa) and there is absolutely no need to define
a separate variable to use an array value.
And finally: Either you have to make sure, that $playme[$play][3] does
not contain any "HTML stuff" or use htmlspecialchars() to encode/escape
special characters so they will be displayed properly.
Here a proposal how it should work (not checked - there may be typos):
<?php
foreach($numbers as $play) {
echo '<li>';
echo '<a';
echo ' class="aplay"';
echo ' href="http://mroldies.net/index.php?tune='.$play.'"';
echo ' target="show"';
echo ' data-src="http://mroldies.net/200/'.$playme[$play][4];
echo '">';
echo htmlspecialchars($playme[$play][3]);
echo '</a>';
echo '</li>';
}
?>
F'Up to comp.lang.php since this has nothing to do with JavaScript at all.
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-11-07 16:29 -0500 |
| Message-ID | <36y6sabys9lg$.1bhflgz2ufy0$.dlg@40tude.net> |
| In reply to | #11761 |
On Thu, 07 Nov 2013 22:01:10 +0100, Arno Welzel wrote:
> richard, 2013-11-07 19:06:
>
>>
>> www.mroldies.net/index.php
>>
>> this is not the same page as the home page as that is still active for the
>> moment.
>>
>> I am trying to pass the value in the url to the iframe.
>> No matter what I try, it won't.
>> I had to use the \" in order for the link to show properly.
>
> Yes - because the string is already delimited with double quotes.
>
>> The iframe is named "show".
>>
>> My thinking is that the javascript has somehow destroyed that.
>
> What JavaScript? There is no JavaScript in the code you present here.
>
>> Queswtion is, how do I make it work so that the value "tune" will pass
>> properly?
>
> Don't put target="show" inside the href attribute. Check the created
> HTML - you will hopefully see the error.
>
> You define $htp as:
>
> $htp="http://mroldies.net/index.php?tune=".$play." target=\"show\"";
>
> But then you write:
>
> echo "<a class='aplay' href='".$htp."' ...
>
> So - expand this - it will become:
>
> <a class='aplay'
> href='http://mroldies.net/index.php?tune=$play target="show"'
>
> Try to think about the problem - step by step. And not just put together
> a bunch of code without caring for details!
>
> If you put just the anchor attributes line by line the code also becomes
> much easier to read. Also note that you can enclose double quotes in
> single quotes (and vice versa) and there is absolutely no need to define
> a separate variable to use an array value.
>
> And finally: Either you have to make sure, that $playme[$play][3] does
> not contain any "HTML stuff" or use htmlspecialchars() to encode/escape
> special characters so they will be displayed properly.
>
> Here a proposal how it should work (not checked - there may be typos):
>
> <?php
> foreach($numbers as $play) {
> echo '<li>';
> echo '<a';
> echo ' class="aplay"';
> echo ' href="http://mroldies.net/index.php?tune='.$play.'"';
> echo ' target="show"';
> echo ' data-src="http://mroldies.net/200/'.$playme[$play][4];
> echo '">';
> echo htmlspecialchars($playme[$play][3]);
> echo '</a>';
> echo '</li>';
> }
> ?>
>
> F'Up to comp.lang.php since this has nothing to do with JavaScript at all.
If you'd bother to note I cross posted this for that reason.
Thanks.
But it still won't transfer.
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2013-11-08 08:33 +0100 |
| Message-ID | <527C93B3.4000109@arnowelzel.de> |
| In reply to | #11762 |
richard, 2013-11-07 22:29:
> On Thu, 07 Nov 2013 22:01:10 +0100, Arno Welzel wrote:
>
[Building a list of links with a frame as target]
>> And finally: Either you have to make sure, that $playme[$play][3] does
>> not contain any "HTML stuff" or use htmlspecialchars() to encode/escape
>> special characters so they will be displayed properly.
>>
>> Here a proposal how it should work (not checked - there may be typos):
>>
>> <?php
>> foreach($numbers as $play) {
>> echo '<li>';
>> echo '<a';
>> echo ' class="aplay"';
>> echo ' href="http://mroldies.net/index.php?tune='.$play.'"';
>> echo ' target="show"';
>> echo ' data-src="http://mroldies.net/200/'.$playme[$play][4];
>> echo '">';
>> echo htmlspecialchars($playme[$play][3]);
>> echo '</a>';
>> echo '</li>';
>> }
>> ?>
>>
>> F'Up to comp.lang.php since this has nothing to do with JavaScript at all.
>
> If you'd bother to note I cross posted this for that reason.
What reason? Please explain. Your code did not contain any JavaScript.
> Thanks.
> But it still won't transfer.
Please define "transfer". What is missing?
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web