FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to transfer value to iframe?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: resolved?? Re: How to transfer value to iframe? [message #183155 is a reply to message #183152] Thu, 10 October 2013 23:51 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
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}&amp;name={$alpha}'></iframe>";

AISB, conversion of ”&” to “&amp;” or &#38; 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;
?>&amp;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 ?>&amp;name=<?=
htmlspecialchars($alpha) ?>"></iframe>

and

<iframe id="x1" src="audiox1.php?asong=<%= $number %>&amp;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 ?>&amp;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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: please unsubscribe me
Next Topic: Can't change upload_max_filesize
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 10:27:52 GMT 2024

Total time taken to generate the page: 0.03291 seconds