views:

88

answers:

1

Ok, so I'm used to working with C# and ASP.NET which automatically allows one to display database results immediately on the same page from which they were requested.

I am, however, now using PHP which I haven't coded in in years. I have the results popping up in a separate page because the form tag's 'action' option is set to that specific PHP page. I need these results to display, though, in the same page that I'm clicking the button. Any ideas?

Thanks in advance.

Josh

+1  A: 

Set the 'action' tag to the current page, and move the POST request handling logic to that current page.

JoshJordan
quick question. how do I prevent the php logic from executing when the user visits the page for the first time?
@Josh: simply check if you have any data in $_POST[]
Javier
Check for your specific data in _POST. Actually, you may want to take this a step further, and also display the "first visit" page state in the case of a query returning an empty result set.
JoshJordan