Replacing php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Nicole
Forum Newbie
Posts: 22
Joined: Thu Oct 26, 2006 7:47 am

Replacing php

Post by Nicole »

How would I replace this
<?php
$getfile = rand(1,5);
$includefile = "file" . $getfile . ".txt";
include ($includefile);
?>

on my web page, with another one exactly the same after the
first one executes? Very important, I hope someone can give me some ideas. Thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Copy and paste the code.

:?
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Another what?
Nicole
Forum Newbie
Posts: 22
Joined: Thu Oct 26, 2006 7:47 am

Post by Nicole »

Funny guy :lol:

Replace the code I listed with another after the first one executes. I already know how to
do page refreshes etc, this is an odd request but still an important one. Javascript won't work, it has to read as php.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Re: Replacing php

Post by neel_basu »

Nicole wrote:How would I replace this

Code: Select all

<?php
$getfile = rand(1,5);
$includefile = "file" . $getfile . ".txt";
include ($includefile);
?>
on my web page, with another one exactly the same after the
first one executes? Very important, I hope someone can give me some ideas. Thanks.
I Really Didn't Understand Clearly What You Told ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Nicole wrote:Funny guy :lol:

Replace the code I listed with another after the first one executes. I already know how to
do page refreshes etc, this is an odd request but still an important one. Javascript won't work, it has to read as php.
Seriously, what's wrong with copy-and-paste?
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Nicole wrote:Funny guy :lol:

Replace the code I listed with another after the first one executes. I already know how to
do page refreshes etc, this is an odd request but still an important one. Javascript won't work, it has to read as php.
I'm still confused as to what you're trying to replace. Are you trying to include that file only the first time the user visits the site? Are you replacing the file being included? To "replace" code itself, you would adjust the conditions under which it executes by using an 'if' statement.
Post Reply