![]() |
pass $_POST data into popup window
Hi all!
I have a page (generated with PHP) that has a list of employee names. What I want to do is, when the user hits on each name, a pop-up window (using Javascript) to appear which will say some more details on the employee (i.e his age, job experience etc). So I thought I make a form for each employee name, and use hidden fields to pass the info I want. For example <form> <input type="hidden" name ="age" value="23 years old"> <input type="hidden" name="experience" value="expert"> <input type="submit" value="John"> </form> With the above, I show a little example of course. What I have is a submit button with John's name written in it and I want, when the user clicks on John, a pop-up window to appear and contain the "hidden" values of age and experience in it. I don't know much about Javascript, i tried usind the document.write function, but no luck. I can only "send" data to the next page that are written in an input field, but not data that are written in hidden fields... Any thoughts? |
Your terminology isn't clear. Hidden fields in a form are submitted as well as normal fields. You can fill in the hidden fields on the server before responding with the page. When you pop the window, just move the fields to the child. If you don't want to go to the server every time a different name is clicked, you can construct a Javascript array on the server and dump it into the page. If you don't mind going to the server, but don't want to rebuild the whole page, use the xml-http thangy.
|
Here's how I would do it: I'd have the list of names, which would link to a popup with the user ID number as a parameter:
[html]<a href="#" onclick="javascript:window.open('person.php?id=5');">John Smith</a>[/html] I'd then get the information in the popup page, rather than unnecessarily loading all of it at once for the list. |
| All times are GMT -5. The time now is 6:55 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC