Page 1 of 1

how to call a search form

Posted: Thu Sep 05, 2002 3:09 am
by Big Jerry
Hi everybody

I'am a newbe in PHP programming. So this is just a simple question for experts.

Assume I have a form that stores customer data like name, prename, address, and so on. On filed I would like to fill by calling a second php page (in a new browser window) that executes a query to the database, displays the results and lets the user choose on of it. The user presses the a ok button, the second window closes and the choosen result is displayed in the first form.

I already tried to find a solution, but everytime I close the second window after the result selection, the content of the first form is vanished.

How do I need to store the data of the first form?
How can I pass the choice of the second window back to the first form and redisplay the data?

Thx
Tom :? [/quote]

Posted: Thu Sep 05, 2002 3:28 am
by Takuma
If you press submit the form data will go.

Posted: Thu Sep 05, 2002 3:55 am
by Big Jerry
Actually I do not press the submit button when I call the second php page. I just need to find a way that I can pass back the data back to the first form without calling the first php page again (that would clear the form). So in the second php I need to store the choice and get it from somewhere when I am back in the first.

Posted: Thu Sep 05, 2002 4:58 am
by Wayne
To do this you will need to use JavaScript on some other client-side scripting language. Try looking in the Client-Side forum and you should find some relevant post that will help you.
http://www.devnetwork.net/forums/viewtopic.php?t=667

values between windows using javascript

Posted: Thu Sep 05, 2002 8:21 am
by gite_ashish
first.html

Code: Select all

<HTML>
<HEAD>
<SCRIPT type="text/javascript">

    function openWnd()
    &#123;
        window.open( 'popup.html', '', 'width=400,height=400' );

        return false;
    &#125;

</SCRIPT>

<PRE>
<H3>Form-1</H3>
<FORM name=frm method=POST onSubmit="return openWnd();">

    Name1: <INPUT type=text name=txtName1>
    Name2: <INPUT type=text name=txtName2>

    <INPUT type=submit value=OpenWnd>
</FORM>
</PRE>
</BODY>
</HTML>
===========================================

popup.html

Code: Select all

<HTML>
<HEAD>
<SCRIPT type="text/javascript">

    function setOldVal()
    &#123;
        document.frm.txtName1.value = opener.document.frm.txtName1.value;
        document.frm.txtName2.value = opener.document.frm.txtName2.value;
    &#125;

    function closeWnd()
    &#123;
        opener.document.frm.txtName1.value = document.frm.txtName1.value;
        opener.document.frm.txtName2.value = document.frm.txtName2.value;

        window.close();
    &#125;

</SCRIPT>
</HEAD>

<BODY onLoad="setOldVal();" onUnload="closeWnd();">
<PRE>
<H3>Form-2</H3>
<FORM name=frm method=POST onSubmit="closeWnd();">

    Name1: <INPUT type=text name=txtName1>
    Name2: <INPUT type=text name=txtName2>

    <INPUT type=submit value=CloseWnd>
</FORM>
</PRE>
</BODY>
</HTML>

Posted: Thu Sep 05, 2002 9:35 am
by PingLeeQuan
thanks guys ... i also have been looking for something similar for a LONG time