0

我在 javascript 中找到了很多方法,但我需要在 php 脚本中间调用 smack。

<form action="" method="POST" target='popup' onsubmit="window.open('','popup','width=700,height=400,left=200,top=200,scrollbars=1')">
        Send a message  : <input type="text" name="twitmessage"><br>
        <input type="checkbox" name="twitter" value="My Posting Text">Would you like to send to Twitter?<br>
        <input type="checkbox" name="facebook" value="Stuff to Post to facebook">Would you like to post to Facebook?<br>
        <input type="submit" name="submit_cycle" value="Submit">
</form>
<?php
session_start();
// store session data
$_SESSION['twitmessage'] = $_POST['twitmessage'];

if(isset($_POST['submit_cycle'])) {
        if($_POST['twitter']){
                header("location: ../index.php?p=members");
        }
        if($_POST['facebook']){
                header("location: ../index.php?p=paybill");
        }else{
                echo "Something bad happened";
        }
}
?>
4

2 回答 2

0

你不能。

打开窗口是一种客户端操作,无法使用 PHP 执行。这是原则上的。

您可以生成 JS,它将在客户端打开一个新窗口。

<script>
    window.open('<?php echo htmlentities($url); ?>')
</script>
于 2013-11-13T20:02:58.987 回答
0

另一种方法。也许我没有理解你的意图。

要在不同的窗口中打开 twitter 对话框,您可以简单地添加target=_blank到表单中。

其余的应该和上面一样。

要创建一个大小合适的窗口,请创建一个新的命名窗口。然后缩放它并将窗体的目标设置为窗口的名称。

于 2013-11-13T20:15:18.407 回答