iwato Posted November 21, 2017 Share Posted November 21, 2017 BACKGROUND: Good ideas are sometimes like luck, they come in streaks. Thanks to the experiential wisdom of this forum and those around me in the Galvanize collective workspace, I have decided to tarry a little longer with the reconstruction of my data base. Indeed, I have learned a new term -- normalization. What before I intended to achieve with row duplication I hope now to achieve with simple updates. In order to achieve this important structural change and still retain the benefits of the old structure, I must disengage one of my form's <fieldset>s and create from it a new form that is submitted manually and only occasionally. It would appear that the small changes to the separate table that this fieldset previously replenished with each new form submission can now be achieved with MySQL TRIGGER and UPDATE statements. This strategy has led to the following two questions: QUESTION ONE: Under the assumption that one can have only one $_POST variable per page how does one typically go about using the same $_POST variable for multiple forms on the same page? If I were to implement this task on my own, without the advice of others, I would create a bivariate if-. else if-, else- statement that tests for the present of one of two variables and then handles only that data associated with the form submitted. Is there another, perhaps more thorough, separation that does not include the creation of a separate form page? QUESTION TWO: When executing a MySQL TRIGGER that updates a single row value of a single column of a table different from the one that executes the trigger, will the DEFAULT setting for the UPDATE statement trigger a timestamp with the ON UPDATE CURRENT_TIMESTAMP? As always your wisdom would be well-appreciated. Roddy Link to comment Share on other sites More sharing options...
justsomeguy Posted November 22, 2017 Share Posted November 22, 2017 I don't think your question is worded correctly, $_POST is available on every request but your browser will only send one request at a time. Meaning you can only submit one form at a time. Anything that you want to be submitted all needs to be in the form. Of course, you can use Javascript to add or remove form elements if you want to build an interface like that. But each request to the server is only 1 request, you don't send multiple requests at the same time other than if you're using ajax to send a bunch of requests, but even so that's not the best idea. If you find yourself sending multiple requests in a short period you probably need a more efficient design, requests have overhead. If you're just asking how you can structure a page with multiple forms where you can figure out which form was submitted, there's a post about that here: http://w3schools.invisionzone.com/topic/12509-php-tips-and-tutorials/ I would assume that the trigger would update the timestamp, but the final word there is to just test it. 1 Link to comment Share on other sites More sharing options...
iwato Posted November 22, 2017 Author Share Posted November 22, 2017 Yes, this was the question. Quote If you're just asking how you can structure a page with multiple forms where you can figure out which form was submitted ... And, what a great answer! I wish you and everyone else at W3Schools a fabulous Happy Thanksgiving! With a little good fortune it could prove to be one very productive holiday. Roddy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now