[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 07-09-2006, 06:42 AM   #1 (permalink)
New Member
 
Join Date: Jan 2006
Location: USA
Posts: 20
0.00 NP$ (Donate)

DJDOG is an unknown quantity at this point


Request: PHP Help

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...)
DJDOG is offline  
Old 07-12-2006, 10:19 AM   #2 (permalink)
NamePros Regular
 
monaco's Avatar
 
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 695
314.80 NP$ (Donate)

monaco will become famous soon enough


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.
__________________
My Website | My Blog
monaco is offline  
Old 07-15-2006, 01:50 AM   #3 (permalink)
New Member
 
Join Date: Jul 2006
Posts: 20
0.00 NP$ (Donate)

Scolls is an unknown quantity at this point


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
Scolls is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 04:45 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85