subash85 Posted June 15, 2009 Share Posted June 15, 2009 frens.. i have attached the file...in the post.. hope you will all view the file and help me out for my problem.. actually i would like to make only one file for every adding and deleting process.. i am juz frustated with making lots of file for addin and deleting the data from database.. so i would like to make eg. add.php?action=something... and delete.php?action=something.. can yuo help me out thanking you... [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
joel24 Posted June 15, 2009 Share Posted June 15, 2009 just use the isset() function in your index file and use that to include the corresponding files... i.e. in your index, after you do all your admin checking etc, this example is for your do_add_ptype.php file. if (isset($_POST['new_ptype'])) { include ("do_add_ptype.php"); } the isset($_POST['new_ptype'])) checks if the $_POST['new_ptype'] is set, i.e. if a form containing an element with the name new_ptype has been sent... and if this is true, the if statement then includes the corresponding file so it can be executed. play around with this concept and you'll get it working? just make sure the $_POST['whatever'] has a unique identifier for each use case. this way all your forms should be posting to index.php... you might have to edit the do_add_ptype.php file a bit to make it work... and you can remove the dbconnect etc includes from the top of each file... and maybe put them in a seperate folder 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.