To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-18-2006, 06:53 PM   #1
ktsirig
Member
 
Join Date: Sep 2005
Posts: 47
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?
ktsirig is offline   Reply With Quote
Old 04-18-2006, 08:43 PM   #2
bpat1434
NMaOtBG
 
bpat1434's Avatar
 
Join Date: Oct 2004
Location: Around 255.255.255.0
Posts: 8,093
This seems to work:
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script type="text/javascript" language="JavaScript">
<!--
function popWindow(wName){
	features = 'width=400,height=400,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no';
	pop = window.open('',wName,features);
	if(pop.focus){ pop.focus(); }
	return true;
}
-->
</script>
</head>

<body>
<form action="js_pop.php" method="post" target="Details" onSubmit="return popWindow(this.target)">
<input type="hidden" name ="age" value="23 years old">
<input type="hidden" name="experience" value="expert">
<input type="submit" value="John">
</form>
<form action="js_pop.php" method="post" target="Details" onSubmit="return popWindow(this.target)">
<input type="hidden" name ="age" value="26 years old">
<input type="hidden" name="experience" value="novice">
<input type="submit" value="James">
</form>
<form action="js_pop.php" method="post" target="Details" onSubmit="return popWindow(this.target)">
<input type="hidden" name ="age" value="21 years old">
<input type="hidden" name="experience" value="intermediate">
<input type="submit" value="Jack">
</form>
</body>
</html>
js_pop.php
PHP Code:
<?php
echo '<pre>';
var_dump($_POST);
echo
'</pre>';
?>
bpat1434 is offline   Reply With Quote
Old 04-19-2006, 06:55 PM   #3
ktsirig
Member
 
Join Date: Sep 2005
Posts: 47
excellent post!!!
I think you hit exactly what I needed! Thank you so much for your time!
ktsirig is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 09:07 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.