dongtao1262 2013-06-14 20:17
浏览 50

从php对话框提交外部表单

I'm loading an external php page into a dialog on my user page (user.php). The external page (contact.php) contains a form.

I'd like to submit the form and then return a message to the user in the dialog.

When I run contact.php the form submits. I can't submit it from the dialog on user.php- I appreciate the help.

Here is the jquery from user.php

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

In the html on the first page (user.php)

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

Here is the code from 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>
  • 写回答

1条回答 默认 最新

  • duanhuizhe6767 2013-06-14 20:38
    关注

    Just realised the problem - I'm using a php echo to define the form's action - which doesn't work and shows up null, replaced it with the hard coded string and everything is peachy!

    评论

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题