这是我正在处理的脚本,它应该在打开时集成用户并传递
<?php
$name = $_POST['name']; // contain name of person
$pass = $_POST['pass']; // Email address of sender
$link = window.open(https://secure.brosix.com/webclient/?nid=4444&user=$name&pass=$pass&hideparams=1 'width=710,height=555,left=160,top=170');
echo $link;
?>
我这样做是对的,我想在用户将表单提交到php代码后打开一个弹出窗口,但我总是收到错误。
答案 0 :(得分:5)
将您的代码更改为此
<?php
$name = $_POST['name']; // contain name of person
$pass = $_POST['pass']; // Email address of sender
$link = "<script>window.open('https://secure.brosix.com/webclient/? nid=4510&user=$name&pass=$pass&hideparams=1', 'width=710,height=555,left=160,top=170')</script>";
echo $link;
?>
附加说明
您应该考虑使用fancybox,它可以使用iframe在弹出窗口中整体加载网页。还有其他选择,可以随意探索!
答案 1 :(得分:1)
您忘记在$ link的值附近加上引号和标记。
$link = "<script>window.open(\"https://secure.brosix.com/webclient/?nid=4444&user=$name&pass=$pass&hideparams=1width=710,height=555,left=160,top=170'\")</script>";
答案 2 :(得分:0)
你不必使用php你只需创建具有特定id的提交按钮然后告诉jquery在提交时触发新标签
<form id="itemreport_new" type="post" action="">
<input id="submit2" type="submit" value="show" target=_blank />
</form>
$(document).ready(function () {
$('#submit2').click(function() {
$('#itemreport_new').attr('target','_blank');
});
});
答案 3 :(得分:-1)
<?php
echo "<h1>Hello, PHP!</h1>";
$name = $_POST['name']; // CONTAIN NAME OF PERSON
$pass = $_POST['pass']; // ANY DETAIL OF PERSON
$link = "<script>window.open('https://google.co.in')</script>";
echo $link;