Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11761
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Newsgroups | comp.lang.php, comp.lang.javascript |
| Subject | Re: values won't transfer |
| Followup-To | comp.lang.php |
| Date | 2013-11-07 22:01 +0100 |
| Message-ID | <527BFF96.2070809@arnowelzel.de> (permalink) |
| References | <e2vbaluuftp4$.48nrw7i8j930.dlg@40tude.net> |
Cross-posted to 2 groups.
Followups directed to: comp.lang.php
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
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web