Jump to content

[SOLVED] need help plss..?


subash85

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/162207-solved-need-help-plss/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.