从php对话框提交外部表单


Submitting an External form from a php dialog

我正在将外部php页面加载到我的用户页面(user.php)的对话框中。外部页面(contact.php)包含一个表单。

我想提交表单,然后在对话框中向用户返回一条消息。

当我运行contact.php时,表单提交。我不能从user.php对话框提交它-我感谢帮助。

这是来自user.php的jquery
$(document).on('click', '#contact_tutor', function(){
$('div#dialog').load("contact.php?id="+uid)
.dialog({
    width: 800,
    height: 425,
    title: "Contact,
});
});

在html的第一页(user.php)

<div id="contact_tutor" class="contact"><a href="#">Contact <?php echo $name;?></a></div>
<div id="dialog" ></div>

下面是Contact.php

的代码
<?php
include_once($_SERVER['DOCUMENT_ROOT']."/MySite/php_includes/check_login_status.php");
if (isset($_POST['posted'])&& isset($_POST['message'])){
//do stuff
?>
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="style/style.css">
</head>
<body>
    <form id="message" method="POST" action="<?php echo $PHP_SELF;?>" class="contact">
    <label>Your Name:</label> <input type="text" name="sender_name" value=""></br>
    <label>Email:</label><input type="text" name="sender_email" value=""></br>
    <label>Message:</label><textarea class="textbox" cols="53" rows="10" name="message" value=""></textarea>
    <input type="hidden" name="posted" value="posted">
    <input type="Submit" value="Send Message">
    </form>
        <div class="statuserror"><?php echo $err?></div>
</body>
</html>

刚刚意识到问题-我使用php echo来定义表单的动作-它不起作用,显示为空,用硬编码字符串代替它,一切都是桃色的!