LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to show results of a php query from a form on the main form (https://www.linuxquestions.org/questions/programming-9/how-to-show-results-of-a-php-query-from-a-form-on-the-main-form-652112/)

texmansru47 06-27-2008 12:25 PM

how to show results of a php query from a form on the main form
 
All,

I need to see how to run a php form that will process an user query and place the results of that query on the main form that the user run to start the query (i.e. if the main form is testme.html I desire the results of the testme.php query to be placed on testme.html).

Now I need to see about the syntax of how to do this.

In my form I have:

<form method="POST" name="testme" action="testme.php">

now typically this would call a php script to process the query in question... and the results would be echoed there whereever I ask on that page... but I need for the data to be displayed on the main form that starts the whole action.

So is there something I need to do to change the "action="testme.php" statement or is there another way. I cannot find anything on this... you would think with a great deal of webpages doing this very function this data would be available for review... but it is not.

Any ideas would be great.

Texman

b0uncer 06-27-2008 01:06 PM

There is a great PHP tutorial at W3C's website, check it out.

If I got you right, you'll want to use only one page -- testme.php, if you like. Make it contain both the processing code and the form, so that the form's action is the php file itself; this way the content is displayed on the very same page. Just make a "selection" in the php code (using if..else, for example) so that based on some condition (like if something was received via POST/REQUEST that means the form was submitted) the results are shown, and in the other case (form was not submitted) the form is displayed instead. There's an example of this sort of function in the tutorial I mentioned.

texmansru47 06-27-2008 01:26 PM

I actually got it to work... where is that website? Can I google W3C and get the link?


All times are GMT -5. The time now is 09:44 PM.