send variable to php script via URL

jyhm

Ultra Geek
OK, am i loosing my mind?:eek:
If I remember correctly you can send variable data to a script via a url as such;

Code:
http://www.url.com/myscript.php?variable=value
But it is not working and I don't know why!

This is my simple script to test why my GET and POST function is not working. Here is the link, does it show the value for the variable $jaded in your browser? You can play with the ?jaded=

http://www.jyhm.net/jade.php?jaded=wut+the+bleep!

Code:
<html>
<head>
<title>Pass Variables</title>

</head>
<?php


echo 'This is your variable here <br><br><font color="blue">';

echo $jaded;

echo '</font>';


?>

<body>

</body>
</html>
 
I've tried that but it still comes up blank!

Code:
echo $jaded;
echo $_Get['jaded'];
echo $_Post['jaded'];
 
Ok, it works when I did it like this;

Code:
<?php

$val = $_GET['jaded'];
echo "the word is: $val";


?>
I am perplexed as to why the first didn't work. As they used to work, maybe because my server uses PHP Version 4.4.2 and my mac uses PHP Version 4.3.10.

I remember earlier version of 4 working fine with this code. Why would they depricate this method?
 
I'm not sure why it doesn't work with the straight echo but they make you use $_GET and $_POST for security purposes. The echo might have something to do with the same security settings. You can turn it off in the PHP config for backwards compatibility but by default it's set so you can't use $var.
 
Back
Top