PHP从模态重新加载页面

时间:2017-01-23 10:08:33

标签: php modal-dialog

我正在尝试使用onClick =“location.href ='Edit_Equip.php?txtidforsite ='”/>重新加载页面但我得到通知:未定义的变量:id 我试图定义id但仍然得到错误任何帮助都会很棒

<?php
    include('connect.php');
    if(isset($_POST['txtidforsite']))
    {
        $id=$_POST['txtidforsite'];
        if(isset($_POST['submit']))
        {
            $query3 = mysql_query("UPDATE ftn_site_equip SET siteidequip='".$_POST['txtidforsite']."', patype='".$_POST['txtpa']."', drxtype='".$_POST['txtdrx']."' WHERE siteidequip='$id'");
            if($query3)
            {
                header('refresh:2; url=#openModa3');
            }
        }
        $query1=mysql_query("select * from ftn_site_equip where siteidequip='$id'");
        $query2=mysql_fetch_array($query1);
?>

        <form method="post" action="" align="center">    
        <input name="txtidforsite" value="<?php echo $query2['siteidequip']; ?>" size="36" class="siteinfotable"/>     
        <input name="txtdrx" value="<?php echo $query2['drxtype']; ?>" size="36" class="siteinfotable"/>     
        <input name="txtpa" value="<?php echo $query2['patype']; ?>" size="36" class="siteinfotable"/>     
        <input type="submit" name="submit" class="update_record_button" value="Update Record" onclick="window.location='#openModal2';" />    
        </form>     
<?php
    }
?>
<div id="openModal" class="cancel_modal">
    <div align="center">        
        <h2 align="center">Are you sure you want to cancel all changes ?</h2>
        <input name="yes" type="button" value="Yes" class="yes_button" onClick="location.href='Edit_Form.php?txtid='" />
        <input name="no" type="button" value="No" class="no_button" onclick="location.href='#close'"/>
    </div>
</div>

<div id="openModal2" class="cancel_modal">
    <div align="center">
        <img alt="" src="Images/tick.jpg"/><br/>
        <h2 align="center">Record Successfully Updated</h2>
    </div>
</div>

<div id="openModa3" class="cancel_modal">
    <div align="center">        
        <h2 align="center">What Next ?</h2>
        <input name="yes" type="button" value="Retrun to Site Information" class="yes_button" onClick="location.href='Edit_Equip.php?txtidforsite=<?php echo $id; ?>'" />
        <input name="no" type="button" value="Search for Another Site" class="no_button" onclick="location.href='search.php'"/>
    </div>
</div>

0 个答案:

没有答案