Good day to everyone! :D
Anybody could give step by step PHP code or explanation with examples of how to get the information to other page.
For example my main page is index.php inside of it I have three links to the following PHP files: roland.php, haydee.php and ricky.php.
Now, if I'm going to click each links. I want to be displayed the information of those three files (roland.php, haydee.php and ricky.php.) inside index.php. The address bar will be looked something like this: index.php?page=haydee.

I'm hoping your favorable assistance.

Thank you very much...

Roland

Good day to everyone! :D
Anybody could give step by step PHP code or explanation with examples of how to get the information to other page.
For example my main page is index.php inside of it I have three links to the following PHP files: roland.php, haydee.php and ricky.php.
Now, if I'm going to click each links. I want to be displayed the information of those three files (roland.php, haydee.php and ricky.php.) inside index.php. The address bar will be looked something like this: index.php?page=haydee.

I'm hoping your favorable assistance.

Thank you very much...

Roland

I'm note sure , Do you want to include those files based on the query string ?

Good day to everyone! :D
Anybody could give step by step PHP code or explanation with examples of how to get the information to other page.
For example my main page is index.php inside of it I have three links to the following PHP files: roland.php, haydee.php and ricky.php.
Now, if I'm going to click each links. I want to be displayed the information of those three files (roland.php, haydee.php and ricky.php.) inside index.php. The address bar will be looked something like this: index.php?page=haydee.

I'm hoping your favorable assistance.

Thank you very much...

Roland

What you want isnt quite clear. However, If you want to include another php file you use:

<?php

// the file path
$file = 'path/to/file.php';

// include the file
include($file);

?>

if in the the file you included you have something like.

$me = 'Im Haydee';

When you print $me in the file doing the including you will notice that it has the value assigned in the file you included.

echo $me; // Im Haydee

To get values from the url, use the variable $_GET, which is created by php with the keys and values in the url assigned.

in your case:

// url is index.php?page=haydee
echo $_GET; // haydee

so you can put this in you php code like:

<?php

$page = $_GET['page'];

include('/absolute/path/'.$page); 

?>

/absolute/path/ is the full path to the directory you have your haydee.php, ricky.php etc files in.

Note that no security measures have been made in the code above. You dont want users to be able to include any file in your directory as they see please, as the code above would do.

eg:

if someone made $_GET equal to '../../passwords.txt' for example. They would be able to view that file.

Good day digital-ether!

Thank you for your code it really helped to me.

I hope you don't be tired of helping those PHP begginers like me. I might ask your help again....

Thanks once again.

Roland (rcasinillo_)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.