Somebody help me in this.
My problem is that in my main page i have a form.
When i click submit button i want to fetch the data and i need to show that data in my form page itself not in another page. How to do this.
I have written the query and i fetched the data but i cant display it in my main page where i had the form. I can display it in another page only.
How to send the fetched data from one page to another page. Somebody help me out in detail.

theNbomr

12-30-2011 12:41 PM

Unless I misunderstand your question, I don't think you can do what you are attempting. In any browser known to me, when you submit a form by clicking a submit button, the browser will automatically fetch a new page. The content of the newly displayed page will consist of whatever the CGI form handler returns, which, as the CGI programmer, can be anything you want.
I will hazard a guess that you are really asking how to exchange data between the browser and server without causing the page to be re-drawn. As I understand it, the usual solution to this is through AJAX mechanisms. It is probably beyond the scope of one LQ thread to fully describe how to accomplish that, but there is plenty of online documentation that explains the process. The Wikipedia AJAX page is probably a good jumping off point.

--- rod.

TB0ne

12-30-2011 12:50 PM

Quote:

Originally Posted by PradeepRahul
(Post 4561750)

Somebody help me in this.
My problem is that in my main page i have a form. When i click submit button i want to fetch the data and i need to show that data in my form page itself not in another page. How to do this.

I have written the query and i fetched the data but i cant display it in my main page where i had the form. I can display it in another page only. How to send the fetched data from one page to another page. Somebody help me out in detail.

Help you with WHAT?? You don't provide any useful details...all you tell is is there's a "form", and you want to send data to another page. Great...how about telling us what this form is written in? Where the data is going TO? Is this PHP? JSP? ASP? What?? ANY Details at all??

You really should get a book on the basics of PHP programming, and look at one of the MANY PHP tutorials you can find online, and learn the basics.

AnanthaP

01-03-2012 03:28 AM

Hi Pradeep,

I agree with TBOne. How are we to know what's your programming environment if you dont tell us.

But there are some ways to achieve what you need -- assuming that you are learning HTML.

Uuse hidden fields as below.
(1) Initially, at the very beginning of the program,
(1a) Check that the hidden field is defined and if defined does it have a value.
(1b) If so then set a flag not to initialise the data in the form.
(2) Proceed as usual.
(3) Finally, when the submit button is clicked, first populate the hidden field with data.
(4) Now if your GET/POST/SCRIPT CALL is set to call the same code then, step (1a) will be true ...