| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| New Member | 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...) |
| |
| | #2 (permalink) |
| NamePros Regular | 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. |
| |
| | #3 (permalink) |
| New Member | 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 |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |