Forum Moderators: open

Message Too Old, No Replies

pass $_POST data into popup window

         

ktsirig

9:47 pm on Apr 18, 2006 (gmt 0)

10+ Year Member



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 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?

Trace

6:02 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



Hope I'm understanding you correctly.

The form with the hidden fields is in the main window and you want to print that info in your popup?

If that's it, try this.

Add this to your main page:
<a href="2.html" target="_blank">test</a>
<form name="frmTest"><input type="hidden" name="txtTest" value="test hidden"></form>

Then add this to your popup:
<script>document.write(window.opener.document.frmTest.txtTest.value);</script>

You should be able to understand how it works after that.