Re: php and javascript

From: Date: Wed, 21 Feb 2001 02:18:25 +0000
Subject: Re: php and javascript
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40878@lists.php.net to get a copy of this message
From: "Carl Natale" <cvn@mainetoday.com> > I need some help passing a variable to a popup window. The following form > collects input from the user and stores it in the variable $summary. > > <? > print "<FORM action=\"hint.php\" METHOD=\"post\">"; > $summary = "Hellow universe"; > print "<INPUT TYPE=\"hidden\" name=\"summary\" > value=\"$summary\"> "; > print "<input type=\"submit\" value=\"Try This\" > onClick=\"window.open('hint.php', 'remote', > 'menubar,scrollbars,resizable,width=350,height=200,left=20,top=20'); > return false;\">"; > print "</form>"; > ?> Try: window.open('hint.php?summary=" . urlencode($summary) . "', ....) Realise that the pop-up window is a totally separate document, from the web server's point of view, hence hint.php cannot magically get the value of $summary from the form page. > > When you click on the "Try This" button, hint.php opens up in another, > smaller window just like I wanted. But the variable $summary doesn't show > up > > <? > file://hint.php script says this > > file://THIS LINE PRINTS > print "Here's the hint:<BR>"; > file://BUT NOT THIS ONE > print $summary; > ?> > > If I take JavaScript out of the submit coding, the browser window moves > to hint.php and prints the $summary variable. > > I'm much more comfortable with PHP than JavaScript. How can I deliver the > text in $summary to a second, smaller window? > > Thank you. >

« previous php.general (#40878) next »