/    Sign up×
Community /Pin to ProfileBookmark

How To Create PHP Pages on The Fly-By Receiving ID as Parameters

Hello friends, I am new to PHP. I would like to know how I can create a PHP page by sending a parameter to another PHP script somewhere in the server, and have a page generated on the fly. Thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@patimagesApr 02.2007 — you can send your parameter using get or post to the 2nd php file, have the parameter read and save a new file on your server using fwrite.
Copy linkTweet thisAlerts:
@jogolApr 02.2007 — maybe this will give you some answers:

http://alistapart.com/articles/phpcms/

or let´s say you have your content stored in a database. in the db table you have a field called id, a field called news_headline and a field called news.

your url looks like this: yoursite.com/index.php?id=2

then you use php to select the database entry with id 2 in the db and display it.

$id = $_GET['id'];

$query = "SELECT news_headline, news FROM yourtable WHERE id = '$id'";

$result = mysql_query($query);

<h1><?php echo $row['news_headline'];?></h1>

<p><?php echo $row['news'];?></p>

so you only need one php file (index.php) to display any news you have in your db. index.php?id=34, index.php?id=158, index.php?id=4, whatever you like.

that´s dynamic content.
×

Success!

Help @elson734 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.18,
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,
)...