http://board.phpbuilder.com/showthread.php?10369260-PHP-echo-to-open-new-window
<?php echo '<script type="text/javascript" language="javascript"> window.open("http://www.something.com"); </script>'; ?>
Pass Variables and get them in next script:
JS method: window.open("http://mysite.com/myfile.php?var1=foo&var2=bar"); myfile.php <?php $var1 = $_GET['var1']; $var2 = $_GET['var2']; ... ?>
Pass back file via readfile as per normal
Pass PHP Variable inside javascript:
- Use string interpolation with double quotes for the echo statement and single quotes everywhere inside the javascript
$link = "http://newpage.com$file"; echo "<script type='text/javascript' language='javascript'> window.open('$link'); </script>";
1 Comment
Anonymous