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

Home » Imported messages » comp.lang.php » changing iframe source via php
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
changing iframe source via php [message #183827] Thu, 21 November 2013 22:23 Go to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
I'm trying to figure out a way so that I can change the iframe source with
just simply changing the src value.
But I keep getting a parse error.

I set the posted value with a link.
value=1 src=page1
value=2 src=page2
value=3 src=page3
if value is anything else, then the home page is used.

<iframe name="home" id="aframe" src="????">

How od I code where the ? are??
Re: changing iframe source via php [message #183831 is a reply to message #183827] Thu, 21 November 2013 23:10 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
richard wrote:

> I'm trying to figure out a way so that I can change the iframe source with
> just simply changing the src value.
> But I keep getting a parse error.

It would help if you told what the parse error was, and showed the relevant
code which is causing the error.
>
> I set the posted value with a link.
> value=1 src=page1
> value=2 src=page2
> value=3 src=page3
> if value is anything else, then the home page is used.
>
> <iframe name="home" id="aframe" src="????">
>
> How od I code where the ? are??

Depends on exactly what it is you want to appear there :-) again, show what
you have tried??


--
Cheers
David Robley

TV is chewing gum for the eyes.
Re: changing iframe source via php [message #183833 is a reply to message #183827] Fri, 22 November 2013 00:21 Go to previous messageGo to next message
invalid is currently offline  invalid
Messages: 1
Registered: November 2013
Karma: 0
Junior Member
On Thu, 21 Nov 2013 17:23:00 -0500, richard <noreply(at)example(dot)com> wrote:

> I'm trying to figure out a way so that I can change the iframe source with
> just simply changing the src value.
> But I keep getting a parse error.
>
> I set the posted value with a link.
> value=1 src=page1
> value=2 src=page2
> value=3 src=page3
> if value is anything else, then the home page is used.
>
> <iframe name="home" id="aframe" src="????">
>
> How od I code where the ? are??

Easy to do in JavaScript. Impossible to do in php.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
Re: changing iframe source via php [message #183834 is a reply to message #183827] Fri, 22 November 2013 00:32 Go to previous messageGo to next message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma: 0
Member
On Thu, 21 Nov 2013 17:23:00 -0500, richard <noreply(at)example(dot)com>
wrote:

> I'm trying to figure out a way so that I can change the iframe source with
> just simply changing the src value.
> But I keep getting a parse error.
>
> I set the posted value with a link.
> value=1 src=page1
> value=2 src=page2
> value=3 src=page3
> if value is anything else, then the home page is used.
>
> <iframe name="home" id="aframe" src="????">
>
> How od I code where the ? are??

You should post your attempts because it is not very clear what you
are trying to do. If you are getting 'value' in a query string and
want to use that to get the associated page in the iframe, then it may
be that you want this:

<iframe name="home" id="aframe" src="page<?php echo
$_GET['value'];?>">
Re: changing iframe source via php [message #183835 is a reply to message #183834] Fri, 22 November 2013 01:23 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Thu, 21 Nov 2013 16:32:05 -0800, Richard Yates wrote:

> On Thu, 21 Nov 2013 17:23:00 -0500, richard <noreply(at)example(dot)com>
> wrote:
>
>> I'm trying to figure out a way so that I can change the iframe source with
>> just simply changing the src value.
>> But I keep getting a parse error.
>>
>> I set the posted value with a link.
>> value=1 src=page1
>> value=2 src=page2
>> value=3 src=page3
>> if value is anything else, then the home page is used.
>>
>> <iframe name="home" id="aframe" src="????">
>>
>> How od I code where the ? are??
>
> You should post your attempts because it is not very clear what you
> are trying to do. If you are getting 'value' in a query string and
> want to use that to get the associated page in the iframe, then it may
> be that you want this:
>
> <iframe name="home" id="aframe" src="page<?php echo
> $_GET['value'];?>">

kind of tried that approach. did not work.
Re: changing iframe source via php [message #183836 is a reply to message #183835] Fri, 22 November 2013 03:24 Go to previous messageGo to next message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma: 0
Member
On Thu, 21 Nov 2013 20:23:35 -0500, richard <noreply(at)example(dot)com>
wrote:

> On Thu, 21 Nov 2013 16:32:05 -0800, Richard Yates wrote:
>
>> On Thu, 21 Nov 2013 17:23:00 -0500, richard <noreply(at)example(dot)com>
>> wrote:
>>
>>> I'm trying to figure out a way so that I can change the iframe source with
>>> just simply changing the src value.
>>> But I keep getting a parse error.
>>>
>>> I set the posted value with a link.
>>> value=1 src=page1
>>> value=2 src=page2
>>> value=3 src=page3
>>> if value is anything else, then the home page is used.
>>>
>>> <iframe name="home" id="aframe" src="????">
>>>
>>> How od I code where the ? are??
>>
>> You should post your attempts because it is not very clear what you
>> are trying to do. If you are getting 'value' in a query string and
>> want to use that to get the associated page in the iframe, then it may
>> be that you want this:
>>
>> <iframe name="home" id="aframe" src="page<?php echo
>> $_GET['value'];?>">
>
> kind of tried that approach. did not work.

"Kind of" rarely does work. Post your code.
Re: changing iframe source via php [message #183842 is a reply to message #183827] Fri, 22 November 2013 11:21 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
Am 21.11.2013 23:23, schrieb richard:

> I'm trying to figure out a way so that I can change the iframe source with
> just simply changing the src value.
> But I keep getting a parse error.
>
> I set the posted value with a link.
> value=1 src=page1
> value=2 src=page2
> value=3 src=page3
> if value is anything else, then the home page is used.
>
> <iframe name="home" id="aframe" src="????">
>
> How od I code where the ? are??

Sorry - but with this non-existing problem description it is impossible
to help you.

Post your *existing* code - and please in a layout that it is readable.


--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Re: changing iframe source via php [message #183845 is a reply to message #183827] Fri, 22 November 2013 13:08 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Thu, 21 Nov 2013 17:23:00 -0500, richard wrote:

> I'm trying to figure out a way so that I can change the iframe source with
> just simply changing the src value.
> But I keep getting a parse error.
>
> I set the posted value with a link.
> value=1 src=page1
> value=2 src=page2
> value=3 src=page3
> if value is anything else, then the home page is used.
>
> <iframe name="home" id="aframe" src="????">
>
> How od I code where the ? are??

$apage=$_GET["page"];
if (empty($apage)) {$apage=0;}

if ($apage=1){
echo '<iframe name="home" id="if1" src="index3.php"></iframe>';
}
else {
echo '<iframe name="home" id="if1" src="home.php"></iframe>';
}

This results in "index3.php" being shown when the site is first loaded.
when the link is clicked, which has ?page=1 as a value, it not only brings
in the correct page, but duplicates the original page as well.

On other pages I swap pages with an iframe with no problems.

www.mroldies.net
compare to www.mroldies.net/index3.php
Re: changing iframe source via php [message #183846 is a reply to message #183845] Fri, 22 November 2013 13:33 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <1csll7c4jvn5r(dot)1aym2fc9ijbqu(dot)dlg(at)40tude(dot)net>, richard
<noreply(at)example(dot)com> wrote:

> On Thu, 21 Nov 2013 17:23:00 -0500, richard wrote:
>
>> I'm trying to figure out a way so that I can change the iframe source with
>> just simply changing the src value.
>> But I keep getting a parse error.
>>
>> I set the posted value with a link.
>> value=1 src=page1
>> value=2 src=page2
>> value=3 src=page3
>> if value is anything else, then the home page is used.
>>
>> <iframe name="home" id="aframe" src="????">
>>
>> How od I code where the ? are??
>
> $apage=$_GET["page"];
> if (empty($apage)) {$apage=0;}
>
> if ($apage=1){
^^^^^^ "Here we go again, oh watch him now, ..."

> echo '<iframe name="home" id="if1" src="index3.php"></iframe>';
> }
> else {
> echo '<iframe name="home" id="if1" src="home.php"></iframe>';
> }
>
> This results in "index3.php" being shown when the site is first loaded.
> when the link is clicked, which has ?page=1 as a value, it not only brings
> in the correct page, but duplicates the original page as well.
>
> On other pages I swap pages with an iframe with no problems.
>
> www.mroldies.net
> compare to www.mroldies.net/index3.php
>

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: changing iframe source via php [message #183848 is a reply to message #183846] Fri, 22 November 2013 13:48 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Fri, 22 Nov 2013 13:33:28 +0000, Tim Streater wrote:

> In article <1csll7c4jvn5r(dot)1aym2fc9ijbqu(dot)dlg(at)40tude(dot)net>, richard
> <noreply(at)example(dot)com> wrote:
>
>> On Thu, 21 Nov 2013 17:23:00 -0500, richard wrote:
>>
>>> I'm trying to figure out a way so that I can change the iframe source with
>>> just simply changing the src value.
>>> But I keep getting a parse error.
>>>
>>> I set the posted value with a link.
>>> value=1 src=page1
>>> value=2 src=page2
>>> value=3 src=page3
>>> if value is anything else, then the home page is used.
>>>
>>> <iframe name="home" id="aframe" src="????">
>>>
>>> How od I code where the ? are??
>>
>> $apage=$_GET["page"];
>> if (empty($apage)) {$apage=0;}
>>
>> if ($apage=1){
> ^^^^^^ "Here we go again, oh watch him now, ..."
>
and I get the same results.

Go to the main page and click the "test" link.
Re: changing iframe source via php [message #183852 is a reply to message #183845] Fri, 22 November 2013 15:27 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
Am 22.11.2013 14:08, schrieb richard:

> On Thu, 21 Nov 2013 17:23:00 -0500, richard wrote:
>
>> I'm trying to figure out a way so that I can change the iframe source with
>> just simply changing the src value.
>> But I keep getting a parse error.
>>
>> I set the posted value with a link.
>> value=1 src=page1
>> value=2 src=page2
>> value=3 src=page3
>> if value is anything else, then the home page is used.
>>
>> <iframe name="home" id="aframe" src="????">
>>
>> How od I code where the ? are??
>
> $apage=$_GET["page"];
> if (empty($apage)) {$apage=0;}
>
> if ($apage=1){

When you will you ever learn the difference between "=" and "=="?

> echo '<iframe name="home" id="if1" src="index3.php"></iframe>';
> }
> else {
> echo '<iframe name="home" id="if1" src="home.php"></iframe>';
> }
>
> This results in "index3.php" being shown when the site is first loaded.
> when the link is clicked, which has ?page=1 as a value, it not only brings
> in the correct page, but duplicates the original page as well.





--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Re: changing iframe source via php [message #183853 is a reply to message #183848] Fri, 22 November 2013 15:30 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
Am 22.11.2013 14:48, schrieb richard:

> On Fri, 22 Nov 2013 13:33:28 +0000, Tim Streater wrote:
>
>> In article <1csll7c4jvn5r(dot)1aym2fc9ijbqu(dot)dlg(at)40tude(dot)net>, richard
>> <noreply(at)example(dot)com> wrote:
>>
>>> On Thu, 21 Nov 2013 17:23:00 -0500, richard wrote:
>>>
>>>> I'm trying to figure out a way so that I can change the iframe source with
>>>> just simply changing the src value.
>>>> But I keep getting a parse error.
>>>>
>>>> I set the posted value with a link.
>>>> value=1 src=page1
>>>> value=2 src=page2
>>>> value=3 src=page3
>>>> if value is anything else, then the home page is used.
>>>>
>>>> <iframe name="home" id="aframe" src="????">
>>>>
>>>> How od I code where the ? are??
>>>
>>> $apage=$_GET["page"];
>>> if (empty($apage)) {$apage=0;}
>>>
>>> if ($apage=1){
>> ^^^^^^ "Here we go again, oh watch him now, ..."
>>
> and I get the same results.

Because of different reasons but NOT because of your WRONG assignment
operation.

if($apage=1)

WILL ALWAYS SET $apage to 1, because a single "=" ALWAYS means "assign
value from the right to the left" - ALWAYS!


--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Re: changing iframe source via php [message #183863 is a reply to message #183845] Fri, 22 November 2013 20:19 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
richard <noreply(at)example(dot)com> wrote in news:1csll7c4jvn5r(dot)1aym2fc9ijbqu(dot)dlg(at)40tude(dot)net:

> if ($apage=1){

You did it again.
Re: changing iframe source via php [message #183864 is a reply to message #183845] Fri, 22 November 2013 20:21 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
richard <noreply(at)example(dot)com> wrote in news:1csll7c4jvn5r(dot)1aym2fc9ijbqu(dot)dlg(at)40tude(dot)net:

> www.mroldies.net
> compare to www.mroldies.net/index3.php

And there's *another* thing you haven't figured out yet -- we can't see your php code, only what
the server renders as a result of *executing* that code.

If you want us to see the code, you have to post it.
Re: changing iframe source via php [message #183869 is a reply to message #183827] Sat, 23 November 2013 01:43 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Thu, 21 Nov 2013 17:23:00 -0500, richard wrote:

> I'm trying to figure out a way so that I can change the iframe source
> with just simply changing the src value.
> But I keep getting a parse error.

What does the parse error say?

> I set the posted value with a link.
> value=1 src=page1 value=2 src=page2 value=3 src=page3 if value is
> anything else, then the home page is used.
>
> <iframe name="home" id="aframe" src="????">
>
> How od I code where the ? are??

I suspect you need to refer back to all those posts we've made in the
past about the need to be extra careful with the handling of quote
characters inside string data.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: changing iframe source via php [message #183878 is a reply to message #183869] Sat, 23 November 2013 19:30 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Sat, 23 Nov 2013 01:43:05 +0000, Denis McMahon wrote:

> I suspect you need to refer back to all those posts we've made in the
> past about the need to be extra careful with the handling of quote
> characters inside string data.

Seems the posts that you need to refer back to are the ones about the
difference between == and = (and possibly === as well).

Although I'm not willing to rule out the possibility of messed up string
quoting also being a factor.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: changing iframe source via php [message #183881 is a reply to message #183878] Sun, 24 November 2013 02:51 Go to previous message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 11/23/2013 11:30 AM, Denis McMahon wrote:
> On Sat, 23 Nov 2013 01:43:05 +0000, Denis McMahon wrote:
>
>> I suspect you need to refer back to all those posts we've made in the
>> past about the need to be extra careful with the handling of quote
>> characters inside string data.
>
> Seems the posts that you need to refer back to are the ones about the
> difference between == and = (and possibly === as well).
>
> Although I'm not willing to rule out the possibility of messed up string
> quoting also being a factor.
>

Wise assumption
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PEAR is dead?
Next Topic: PHP functions to convert markup efficiently
Goto Forum:
  

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

Current Time: Thu Dec 19 15:04:54 GMT 2024

Total time taken to generate the page: 0.02662 seconds