Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-27-2008, 01:25 PM   #1
Registered: Jul 2004
Location: Texas
Distribution: CentOS 4.X
Posts: 42

Rep: Reputation: 15
Question how to show results of a php query from a form on the main form


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.

Old 06-27-2008, 02:06 PM   #2
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
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.
Old 06-27-2008, 02:26 PM   #3
Registered: Jul 2004
Location: Texas
Distribution: CentOS 4.X
Posts: 42

Original Poster
Rep: Reputation: 15
I actually got it to work... where is that website? Can I google W3C and get the link?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP: build query from form entry, then display results in the same form tonedeaf1969 Programming 4 06-22-2007 08:55 AM
How do list the results from my search form? Alexander.s Programming 4 05-09-2005 12:01 PM
shell script works form command line but not form crontab saifee General 1 10-14-2004 11:27 AM
how do I copy a whoel folder form one directory to another form the command line? zwyrbla Linux - Newbie 8 08-24-2004 07:40 PM
PHP show query results Gerardoj Programming 1 05-11-2004 01:31 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration