Anyone know PHP? (solved

dvon1981

Resident Beer Guy
I'm trying to do the following but I don't really know php.

I need to parse a value from a url and append to a url on a page. in cases where that value doesn't exist I need to put a default value.

I think the code should be something like this.
Let's assume the URL is website.com?value=25

CODE

http://newurl.com?value=<?php
if (($_GET['value']) == ' ')
echo "default";

Else {
echo $_GET['value'];}
?>

The code would see value =25 since it's there and give me http://newurl.com?value=25 if the 25 wasn't there it would give me http://newurl.com?value=default
This code doesn't work though so clearly I'm messing up.


Solved: I had an extra space
<?php
if (($_GET['value']) == '')
echo "default";

Else {
echo $_GET['value'];}
?>
 
Top