Reading Parameter with PHP

Reading Parameter passed by the URL can be done in a very fast and easy way.   The following is a sample code that I used for a project involving Products related  Optics and Eye wear and this small code is all You Need and as follows:


   ex.:


       $x_prod_id = @$_GET["prod_id"];

       $x_prod_id = (get_magic_quotes_gpc()) ? stripslashes($x_prod_id) : $x_prod_id;


   executed as :


     <img src="prod_img.php?prod_id=<?php echo $roks->prod_id; ?>" width="250" alt="<?php echo $roks->photoname; ?>"/>


In the sample code above, I had used a function called prod_img.php which accepts a parameter called prod_id and it's value, could be an SKU of a product or a unique identifier.