nrsh_ram Posted November 29, 2008 Share Posted November 29, 2008 hello to all, im new to php.. i need help...i learn a simple thing through php tutorials in net.. i have create a features_hod.php where have 4 tabs "profile,forms,report,search"...each tab have different functions: eg:'profile->update,preview' 'forms->consultation,discussion,activity,attendance 'report->all,differ,active,withdraw,graduate' 'search->directly open the search form' for example when i click the profile tab..it will show two function 'update n preview', for calling this functions...im using this coding <?php if (isset($_GET['pg']) && $_GET['pg'] != "") { $pg = $_GET['pg']; if (file_exists(''.$pg.'.php')) { @include (''.$pg.'.php'); } elseif (!file_exists(''.$pg.'.php')) { echo 'Page you are requesting doesn´t exist'; } } else { @include ('main/Features_HOD.php'); } ?> by using this coding each tab can call own function, my problem is..how to i call the pages of this functions? i want if i click on 'update' it will show the update page, and wen i click on 'preview' it will show preview page...what is the coding? i really no idea...plz help Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 29, 2008 Share Posted November 29, 2008 I'm not sure I follow your question. As you showed in your code, you can include another file's code with the include() function. Are you asking how to call a function within that included file? If so, you call a function in exactly the same way as you normally would. When you include a file, it is exactly as if the code in that included file was present in the file doing the including. I.e. The following combination of foo.php and bar.php is identical to foobar.php: foo.php: <?php include("bar.php"); bar(); ?> bar.php: <?php function bar(){ echo 'foobar'; } ?> foobar.php <php function bar(){ echo 'foobar'; } bar(); ?> If that wasn't what you were asking, then please rephrase your question. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.