kam_uoc Posted February 15, 2007 Share Posted February 15, 2007 is it possible to pass some data to php? my situation is simply follows. let's say there are two files, main.php and child.php. code for main.php <?php if (isset($_POST['str'])){ $text=$_POST['str']; print "Text submited by child is:".$text; } else{ $text=""; ?> <HTML> <HEAD> <TITLE>Main Document</TITLE> <SCRIPT type='text/JavaScript'> function newWindow() { window.open('child.php','sub','HEIGHT=200,WIDTH=200') } </SCRIPT> </HEAD> <BODY> <FORM> <INPUT TYPE='button' VALUE='New Window' onClick='newWindow()'> </FORM> </BODY> </HTML> -------------------------------- code for child.php <HTML> <HEAD> <TITLE>A ChildDocument</TITLE> </HEAD> <BODY> <FORM method='POST' action='main.php'> Enter text to be copied to the main window: <INPUT TYPE='text' name='str'> <INPUT TYPE='submit' name='ok' value='Ok'> </FORM> </BODY> </HTML> -------------------------------- its obvious that it str passes to the main page. but the problem is it doesn't display b'cos no refresh happen. how can i refresh the main page when i click the ok button in the child page. or any other ways to achive this. remember i need the function newWindow() must be happen. hope the ploblem is clear. please help. thanks. Link to comment https://forums.phpfreaks.com/topic/38600-passing-data-javascript-to-php/ Share on other sites More sharing options...
ToonMariner Posted February 15, 2007 Share Posted February 15, 2007 I think you need opener.location = in your js somewhere... This should be in js forum. Link to comment https://forums.phpfreaks.com/topic/38600-passing-data-javascript-to-php/#findComment-185257 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.