Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Request: PHP Help

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
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
Close
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
Close
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
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back