how to call a search form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Big Jerry
Forum Newbie
Posts: 3
Joined: Thu Sep 05, 2002 3:09 am

how to call a search form

Post 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]
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

If you press submit the form data will go.
Big Jerry
Forum Newbie
Posts: 3
Joined: Thu Sep 05, 2002 3:09 am

Post 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.
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post 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
User avatar
gite_ashish
Forum Contributor
Posts: 118
Joined: Sat Aug 31, 2002 11:38 am
Location: India

values between windows using javascript

Post 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>
PingLeeQuan
Forum Commoner
Posts: 58
Joined: Tue Sep 03, 2002 8:08 am

Post by PingLeeQuan »

thanks guys ... i also have been looking for something similar for a LONG time
Post Reply