You can send Variable Names and Values using hyperlinks to PHP Scripts. This is an easy way to send variable data, but is incredibly insecure.
To send a variable to a PHP script add ?variable_name=variable_value to the script link. You can send multiple variables by using & such as get.php?variable1=value1&variable2=value2
$_GET
- https://www.php.net/manual/en/reserved.variables.get.php
- https://www.w3schools.com/php/php_superglobals_get.asp
get.php
<?php
$color = $_GET['color'];
$size = $_GET['size'];
echo "<a href='./get.php?color=blue'> Change Color to BLUE </a><br>";
echo "<a href='./get.php?color=red'>Change Color to RED</a><br><br>";
echo "<a href='./get.php?color=blue&size=20'> Change Color to BLUE and Size to 20</a><br>";
echo "<a href='./get.php?color=red&size=40'>Change Color to RED and Size to 40</a><br><br>";
echo "<h1>Example of Text Output</h1>";
echo "<p style='color:".$color.";font-size:".$size."px;'>This is the output text from GET hyperlinks</p>";
?>
Be the first to comment