Using a sending information through a link
Moderator: General Moderators
Using a sending information through a link
Is there a way I can do something like
<a href="viewScreenshot.php" name="screenshot" value="sc1.bmp">
then when you click it viewScreenshot.php gets the value of the link
( screenshot ) and then opens up the picture sc1.bmp ( because that is value of screenshot )??
Thanks for all help provided.
<a href="viewScreenshot.php" name="screenshot" value="sc1.bmp">
then when you click it viewScreenshot.php gets the value of the link
( screenshot ) and then opens up the picture sc1.bmp ( because that is value of screenshot )??
Thanks for all help provided.
appending key/value-pairs to the url is called GET-method (same as setting method="GET" for a form).
In recent versions of php they are stored in the superglobal array $_GET
In recent versions of php they are stored in the superglobal array $_GET
Here is the link: <a href="viewScreenshot.php?id=sc1.bmp">
Here is viewScreenshot.php:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div align="center">
<?php
$picToView = $_GET['id];
echo("<image src=\"$picToView\">");
?>
</div>
</body>
</html>
Why doesn't this work?
Here is viewScreenshot.php:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div align="center">
<?php
$picToView = $_GET['id];
echo("<image src=\"$picToView\">");
?>
</div>
</body>
</html>
Why doesn't this work?
Code: Select all
<?php
$_GET['id];
?>Code: Select all
<?php
$_GET['id'];
?>