Home »
Imported messages »
comp.lang.php »
values won't transfer
Re: values won't transfer [message #183669 is a reply to message #183663] |
Thu, 07 November 2013 21:01 |
Arno Welzel
Messages: 317 Registered: October 2011
Karma:
|
Senior Member |
|
|
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
|
|
|
Goto Forum:
Current Time: Sun Nov 24 04:58:44 GMT 2024
Total time taken to generate the page: 0.04898 seconds