将表单转换为fancybox并将fancybox转换为iframe未提交

时间:2016-08-06 17:27:53

标签: javascript php html

我在iframe(pg3_1.php)中打开了一个带有fancybox的表单。表单未提交信息。

的index.html:



$(document).ready(function() {
    $('.fancybox').fancybox();
});

<body>  
    <div class="span12">
        <b>Corredor Seleccionado:</b><br>
        <iframe width="820" height="615" src="pg3_1.php" frameborder="0" name='rightside'></iframe>
    </div>
</body>
&#13;
&#13;
&#13;

pg3_1.php页面是:

&#13;
&#13;
$(document).ready(function() {
    //$('#abrirdiv').fancybox();
    $('.fancybox').fancybox();               
});
&#13;
<body>
    <a href='form.php' class='fancybox fancybox.ajax'><button class='btn btn-success' style='float: right;' id='boton'><i class='icon-plus'></i> <strong>Button</strong></button></a>
</body>
&#13;
&#13;
&#13;

表格(form.php):

&#13;
&#13;
function askforsendingform() {
    if (confirm('are you sure?')) {
        document.form.submit()
    }
}
&#13;
<body>
    <?php
        if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    ?>
    <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" role="form" name="form">
        <div class="span5">
            <label for="time">time</label>
            <input type="time" name="initialtime" value="">
            <input type="button" name="submit" value="Enviar" class="btn btn-default" onclick="askforsending()">
        </div>
    </form>
    <?php
        } elseif ($_SERVER['REQUEST_METHOD']=='POST') {
            $time = $_POST['initialtime'];
            $sql="INSERT INTO tabletime (time) VALUES ('$time')";
            mysql_query($sql3) or die(mysql_error());
    ?>
</body>
&#13;
&#13;
&#13;

我没有提交,控制台中没有错误显示,提前感谢

0 个答案:

没有答案