For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2004 > INCLUDE solution1 myway ;)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author INCLUDE solution1 myway ;)
Ludwig Moser

2004-03-27, 11:53 pm

> Can i have parameters in one include for example
> include('param.php?value=1');
>
> and if it's ok How can i take this parameters since param.php;


you may solve it that way:

index.php
<?php
include('param.php?value=1');
?>

param.php
<?php
$value= isset($HTTP_GET_VARS["value"]) ? $HTTP_GET_VARS["value"] :
"default_value";
echo "given parameter was: $value";
# if you do NOT pass anything it will output:
# eg. include('param.php');
# given parameter was: default_value
# otherwise [include('param.php?value=1');] you will see:
# given parameter was: 1
?>

hope that helps and i understood you the right way ;)

Luke


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com