Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #21916 > unrolled thread

values won't transfer

Started byrichard <noreply@example.com>
First post2013-11-07 13:06 -0500
Last post2013-11-07 22:01 +0100
Articles 4 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  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 Arno Welzel <usenet@arnowelzel.de> - 2013-11-07 22:01 +0100

#21916 — values won't transfer

Fromrichard <noreply@example.com>
Date2013-11-07 13:06 -0500
Subjectvalues 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]


#21917

FromTim Streater <timstreater@greenbee.net>
Date2013-11-07 18:56 +0000
Message-ID<071120131856545872%timstreater@greenbee.net>
In reply to#21916
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]


#21920

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2013-11-07 19:58 +0000
Message-ID<0.87dda07a0cfaaeb46297.20131107195820GMT.87eh6svvab.fsf@bsb.me.uk>
In reply to#21916
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]


#21923

FromArno Welzel <usenet@arnowelzel.de>
Date2013-11-07 22:01 +0100
Message-ID<527BFF96.2070809@arnowelzel.de>
In reply to#21916
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] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web