Using $_GET in PHP include with variable in the include URL -
firslty, please forgive ineloquent phrasing of question.
what trying do, create simple odbc script, , store in file included in main php file several times different variables.
when including them, want specify variables pass it.
my example be:
main page
include("table-fields.php?table=sometable");
table-fields.php
$table = $_get['table']; odbc_exec(some database function tbl= $table);
however, if understanding correct, $_get global, looking main.php?table=
would better choice set variable before including, e.g.:
$table = table; include("table-fields.php");
table-fields.php
odbc(some database function tbl= $table);
i want try , avoid if possible.
thanks, eds
when including file, contents of file outputted current file, it's not requested http, need :
$table = "sometable"; include("table-fields.php");
and in included file, use variable :
odbc(some database function tbl= $table);
as included content work if wrote in main file etc.
Comments
Post a Comment