[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Whats the method to have a window opened and return that value to the current webpage in PHP

Posted on 2011-09-11
18
Medium Priority
?
183 Views
Last Modified: 2012-05-12
We're trying to do something like in VB.  Open a look-up, select a row, and return the value selected to the parent window where the look-up window was selected.... but to no success.

Is this possible and can EE direct us on how to apply it to our PHP apps?
0
Comment
Question by:rayluvs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 5
  • 3
18 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36520294
The part about having a window opened may be the sticking point.  Why do you need a separate window?  Why not just bring in a script with require() and let the PHP in the script run the look-up you need?
0
 

Author Comment

by:rayluvs
ID: 36520684
We're not very fluent in PHP and the person we had, left.  So we have to work with this.

We're not familiar with require(), can you I've an example?
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36521780
Good news!  All of the PHP functions are documented in the online man pages.  Example:
http://us2.php.net/manual/en/function.require.php

If you're not fluent in PHP, you will either have to get a PHP person (the fast and easy way to success) or become fluent in PHP (the slow and expensive way to success).  There are a lot of learning resources out there that can help with the latter.  This book is a great place to start.  Very readable with excellent examples.
http://www.sitepoint.com/books/phpmysql4/

PHP also has an introductory tutorial, that includes information about dealing with forms, which is how you get client input from the browser, so your action script can produce an appropriate response.
http://us2.php.net/tut.php

The things you would need to learn about in order to do what you describe are (1) Forms and the relationship to the action script, (2) Your data base (maybe MySQL) and how to query, retrieve and test for errors, (3) how to return the output to the client machine.  These are fairly well understood technologies with simple design patterns, but it is difficult to give you a demonstration script because we do not have your underlying data model.  But that said, the SitePoint book spells it all out.  Now in its fourth printing, it has been a part of my technical library since Version One.
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

Author Comment

by:rayluvs
ID: 36526458
We don't ant to become an expert on PHP, but E has helped us in many of our apps.  We'll look into the links.
0
 

Author Comment

by:rayluvs
ID: 36526581
Just reread your first response, and didn't quite answer your question on "Why do you need a separate window? ".

We want to replicate a process we do in VB; using look-up windows.  in other word, Window-1 has a customer field.  Next to the customer field there is a Binoculars icon. When user clicks on the Binocular, Window-2 appears with a list of Customers.  The user select the specific Customer in Window-2 and after selecting, it closes the window.  After WIndow-2 closes, the Customer selected appears in Customer field in WIndow-1.

Before continuing indulging in this process we want, two questions:

    1. In your experience, can this be done in PHP?
    2. Based on what we need, do you recommend a pop-up window should be used or
        is there another manner in getting what we want?

Please advice

0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 800 total points
ID: 36526824
It can be done in PHP, but usually will be done in conjunction with AJAX.   A commonly used AJAX library is jQuery.  jQuery implements many of the best parts of JavaScript in an easy-to-use framework.
0
 

Author Comment

by:rayluvs
ID: 36526938
Its practical? Based on what we indicated, how would go about it?
0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 800 total points
ID: 36529026
Yes, it's practical.  If it were my application and I did not know much about PHP or AJAX, I would create some good screen shots of what I wanted to achieve (step-by-step illustrations) and I would hire a programmer who knew PHP and had a good portfolio showing his front-end development with jQuery.  The learning curve to become proficient in something like this is measured in years, and time is money.  So I would not try to do it myself.
0
 

Author Comment

by:rayluvs
ID: 36529231
Unfortunately, we have to do it ourselve.

Can you give us an example with at least 2 tables so we can have it as a guide?

Thank you.

0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36529259
No, I'm sorry.  I have a lot of paid work right now, and it would take me away from my clients to produce this.  I've given my best advice so I will sign off now.  

Here is a suggestion.  We have JavaScript and jQuery Zones here at EE.  Use the Request Attention link near the original question and ask a moderator to add your question to those zones.  There may be some other Expert Eyes who have an example they can show you.

Best regards, and best of luck with your project, ~Ray
0
 

Author Comment

by:rayluvs
ID: 36529442
Understood.
0
 
LVL 13

Expert Comment

by:haloexpertsexchange
ID: 36529502
you can interact with the parent window from the opened popup window using javascript.
What you do is use window.opener to refer to anything that is on the parent window.
It is not php but it is a fairly simple way to pass information back to the different window.
0
 

Author Comment

by:rayluvs
ID: 36529520
Wait... the 2 tables question at ID: 36529231 wasn't for this this question.

0
 

Author Comment

by:rayluvs
ID: 36529568
Hi haloexpertsexchange,  Can u give a simple example?  We would like to see the structure and from there on, research on the details of the tools in order to complete.
0
 
LVL 13

Accepted Solution

by:
haloexpertsexchange earned 1200 total points
ID: 36529661
ok what I usually do is know the id of the field that you want the value to go to.
And then do something like this, no tools involved just plain javascript.
window.opener.document.getElementById("fieldid").value;
window.close();

Open in new window

Just so you know this will require that both the parent and the popup be in the same domain and both be in either http or https or you will get permissions issues.
But other than that it works rather well and is easy to implement.
0
 
LVL 13

Assisted Solution

by:haloexpertsexchange
haloexpertsexchange earned 1200 total points
ID: 36529668
woops it should be window.opener.document.getElementById("fieldid").value=customer;
0
 

Author Comment

by:rayluvs
ID: 36529931
Ruano you very much!!  This gives an idea on where to concentrate.

Thanx
0
 

Author Closing Comment

by:rayluvs
ID: 36583072
Thanx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question