PepsiGam3r
PepsiGam3r

Reputation: 302

Send Information From A Webpage To Another

I know this is almost duplicated, a lot of people asked that and a lot answered them by PHP Form but I really didn't find anything for my problem. I have a page called platforms.php and this page has a group of image-links which are: Windows,Mac, Android and iOS.
So what I want is when somebody clicks the Windows link (as an example) they go to a page called download.php and the page should say You are using Windows!.
Please not that I don't want to create a page for every link, I want it to be one page only.

Thanks in advance!

Upvotes: 1

Views: 74

Answers (4)

Gaurav
Gaurav

Reputation: 3763

you can add image like

<a href="download.php?key=window"><img src="window.jpg"/></a>
<a href="download.php?key=ios"><img src="ios.jpg"/></a>

and on download.php page you can check

$value = $_GET['key'];
if(value== 'window')
if(value== 'ios')

etc

hope this is what you want.

Upvotes: 0

Fernando Garcia
Fernando Garcia

Reputation: 1969

You can have an HTML link and send the data through GET parameters. Something like (in platforms.php):

<a href="download.php?os=Windows >Windows</a>

<a href="download.php?os=Mac >Mac</a>

<a href="download.php?os=Android >Android</a>

<a href="download.php?os=iOs >iOs</a>

And then in downloads.php, getting the variable "os" and do whatever you want with it:

if ( isset($_GET['os'] ) ) {
     echo "You are using " . $_GET['os'];
}

Upvotes: 0

Nipun Tyagi
Nipun Tyagi

Reputation: 898

Make URL like that

<a href = "http://example.com/download.php?device=window" >Window</a>
<a href = "http://example.com//download.php?device=mac" >Mac</a>

On your page download.php

if(isset($_GET['device'])) {
    $device = $_GET['device'];
}

if ($device == 'window' ) {
        // window message here
} elseif ($device == 'mac' ) {
    // mac message here
}

Upvotes: 2

Sourabh Kumar Sharma
Sourabh Kumar Sharma

Reputation: 2807

send an extra parameter in your url and then in the same single page use the condition like:
let the parameter name be 'pagetype'.

download.php

if ($_REQUEST['pagetype'] == 'windows')
{
//your output for windows
}
else if ($_REQUEST['pagetype'] == 'mac')
{
   //your output for mac
}
else if(..)
{
.
.
.

Note:
You can replace $_REQUEST, with $_GET or $_POST, depending on method you use to post data to this page

Upvotes: 0

Related Questions