![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 54
Rep Power: 3
![]() |
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? |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 8
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|