Page 1 of 1

Easy Question

Posted: Tue May 01, 2007 9:43 am
by mevasquez
I have been out of php for about four years. Boy, how we can forget, but anyway, in my new job I was asked to create a php page which will view a pdf file. This I can do; however, I am having a problem passing the variable data. The link will have the following

...viewpdf.asp?id=6625

when I tried to view the output of $id, I get nothing.

Code: Select all

<?
echo "id=$id"
?>
I get nothing from $id.

I know this is simple but what am I doing wrong?

TIA
Mike

Posted: Tue May 01, 2007 9:47 am
by feyd
Your code assumes two (bad) things: short open tags is on, register globals is on.

<?php is the proper, and only future proof way to start php. $_GET['id'] is the proper way to access the url variable.

isset(), array_key_exists() among others should be of interest too.

Posted: Tue May 01, 2007 12:24 pm
by RobertGonzalez
And you may want to change the file extension from .asp to .php :wink: