A lill PHP help please

Hey guys… OK, hope this makes sense.

On the old host I came from I could put line of code in my php like this.

http://www.youtube.com/v/<?=!empty($id)?"$id":"none" ?>

and when I sent someone to that page to view a video I could give them a link like http://mysite.com/video.php?id=wfffg

Now with DreamHost I can’t seem to get this file to work. Whatever I type in the url doesn’t seem to be connecting with the page code. Do I need to change something in .htaccess or somewhere else to get this to work again?

I think short php tags are disabled. Just change this line: <?=!empty($id)?"$id":"none" ?>

to this: <?php =!empty($id)?"$id":"none" ?>


hmmm… now im getting

Parse error: syntax error, unexpected ‘=’ in /home/.ngu/adam/domain.com/video.php on line 34

<?php =!empty($id)?"$id":"none" ?>

when you use full tags you don’t use the =

just <?php !empty($id)?"$id":"none" ?>

Still coming up with nothing. The page comes up and that’s it. No error or anything. It just seems like the data isn’t getting sent to the page correctly. Last time I had a problem like this I had to make a change to my .htaccess file.

But I cant find my old .htaccess file to check.

Zoinks! I think you gotta echo that output too. I don’t know that switching to long php tags was the problem. What does the current render look like when you view source?


Two things need to be changed from how you had it.

When dropping the short tag with the equals sign, you have to add echo or print. Also, you need to grab your GET variables with $_GET[‘id’] instead of $id.

This should do what you want:

<?php echo (!empty($_GET['id']))?$_GET['id']:'none'; ?>

:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.

Thanks for all your help guys… that worked great!