/    Sign up×
Community /Pin to ProfileBookmark

<?=$_GET[‘pagename’]?> Help

Hi, i have this piece of code

[code=php]
<iframe src=”<?=$_GET[‘pagename’]?>” name=”iframe” width=”780px” height=”450px”frameborder=”0″ scrolling=”no”>
[/code]

How can i make it so that it loads up let say.. indextext.php IF pagename isnt specified.. Is that possible?

Thanks, Fet

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@fciApr 12.2006 — is there any particular reason you are using iframe's instead of includes? and you do know someone could make it point to any url (e.g., for phishing..)

to be lazy, you could do:
&lt;?php echo isset($_GET['pagename']) ? $_GET['pagename'] : 'indextext.php'; ?&gt;

read up on include():

http://us3.php.net/include/
Copy linkTweet thisAlerts:
@acemoApr 12.2006 — [code=php]<iframe src="
<?php
if(isset($_GET['pagename']) AND $_GET['pagename'] != "") echo $_GET['pagename'];
else echo 'indextext.php';
?>
" name="iframe" width="780px" height="450px"frameborder="0" scrolling="no">[/code]
Copy linkTweet thisAlerts:
@scottyrobauthorApr 12.2006 — Hi there.. just looked at the PHP include and im going to do the site that way.... lets say i have to hello.html... it currently opens up hello.html in the window.. how can i make it so that it opens up hello.html in the php include I.E doing something like the HTML version using Target.. so maybe target = php include bassically

Thanks!
×

Success!

Help @scottyrob spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...