--- Jennifer Gardner <[EMAIL PROTECTED]> wrote: > I have a page with four ways to display data stored in a database. For > example: > Display by State Submit > Display by Country Submit > Display by Date Submit > Display All Submit > > The word submit is supposed to represent a submit button. Each of these is > in their own form on one page. I have the information displaying from the > database, but it is there all of the time, for each display option, as soon > as the page is loaded. > > Anyway I want to hide the info until a submit button is selected and then > display the results only for that submit button on the same page. I hope > this makes sense. The site is currently only on my computer so I cannot > provide a url. > > I am assuming each form on the page needs to be wrapped in an if statement > but I am not sure how to set a variable when the submit button is clicked so > that the code can run to display the information in that table only. > > Anyway, I am looking for guidance as to a book or a tutorial where I can > learn to do this. > > Thank you, > Jennifer
Most of the time PHP is used to generate custom HTML or other text content for display in a browser. Hence, you could make a decision in the program with an if() or switch()...case structure to determine which submit button to display. A change will occur based on data available at the time the program is loaded from the server. If you "submit" the form then the page will reload and you can show something different according to the logic of your program. Incidentally, you can put all of the submit buttons in a single form and give them different values (ie button label and value passed) or different names (ie variable name). It need not be in a separate form unless you have a reason to do so. One thing to keep in mind is that if you have a text box and a visitor hits the "Enter" or "Return" key then the form will be submitted by most browsers using the first button it finds. Now, if you expect to send the page code and have the user interact with the loaded copy to change the display (ie click on tabs to change which data is shown when all of the data is loaded at the beginning) then you will want to use Javascript, the topic of other groups than this one. James
