Unstoppable Domains

Request: PHP Help

Spaceship Spaceship
Watch

DJDOG

Established Member
Impact
0
Hello,

I feel really dumb asking this, but I'm in need of some help I like coding with functions like...

<?
function code() {
echo "code here";
}

switch ($action) {
case "Code":
code();
break;
}
?>

The question is I want to use like inside "code to do a & include type of thing like, ?action=Code&id=MoreCode "&id"

How would I go about doing this? (If so please tell me I'm dumb...)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
this ?foo=bar&baz=zeb... style of data passing is just using GET to send data. When the script runs, just use the $_GET variable. In the example above, $_GET['action'] would be "Code", $_GET['id'] would be "MoreCode".

I don't know what you mean by using &include in there...but your example won't work because nobody leaves register_globals turned on. You need to use $_GET to get at them.
 
0
•••
Not sure what you're asking, but if you're wanting to perhaps place all your own functions in a seperate php file and simply include for use in your code, you'd do something like this:

<?
function .... etc etc
//place all your functions in this file
?>

And then include like this in your program:

<?
include("path/functions_filename_whatever.php")
// now you can call your functions just as though they were inside this file
?>

Hope this helped... in case I understood your question correctly
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back