Jump to content

Different forms and outputs, one central script


yoshida

Recommended Posts

Hi.Would it be convenient to have one script that contains all button actions? I know it's possible for a form to have multiple buttons, and for a script to check what button you pressed (and execute the required action) using the if (ISSET...) etc operators. So, the same way as you would make one central css file, would it be convenient to create one central php file for all button actions too? (that would save me lots of 'did I already finish that script', 'what's the frigger called' etc) One would say that thing would be some kind of kernel for web- and intranet based (SQL)applications.

Link to comment
Share on other sites

If you're using PHP, you can do anything you want. :)What you ask and what I understand from it, it can be done if you just tried :blink:Its easy to have some scripts in one file, even stronger, that is possibly the best way :) If it is about the different submit buttons, then you should give those button a NAME attribute in the html part of the form, and check in the process part what value that posted field has to determine what action should be taken :)

Link to comment
Share on other sites

If you're using PHP, you can do anything you want. :)What you ask and what I understand from it, it can be done if you just tried :blink:Its easy to have some scripts in one file, even stronger, that is possibly the best way :) If it is about the different submit buttons, then you should give those button a NAME attribute in the html part of the form, and check in the process part what value that posted field has to determine what action should be taken :)

Yeah, that's what I thought. I already had to use it once because each form can only perform one script.Is there a limit to how many actions you can put in one script? If not I'm intending to go with unique form files and one database processing file. (one backbone script...oooh happy happy debugging ^^)Anyway, the real question is would you recommend it (and why[not])?
Link to comment
Share on other sites

I would recommend having the processor and the form in one document :)You are most certainly not limited by one form at a document, you may create 'subforms' like one form controlling the content of the other.Not exactly, but sort like a menu form, for "register", "login" and "cancel membership" and a form to the right that was build according to the send data of the menu form :)Besides, if you make the processor and the form one and the same document, it is easier to output an error message if the submitted data is invalid or some missing :)In other words, both the form, the alternate forms, and the processor in one file.At least you can use a main document that in which you include the correct file, form or processor, so it would still act as the same document.

Link to comment
Share on other sites

What you're saying is that you can build an entire program within one file? That's just going to be too complicated right now, and I don't want that to limit my ambitions.I'll stick with the separate html forms and the central php file. Thanks for the info anyways - seems like I'll want to learn Perl after all. ^^

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...