当我尝试添加一个确认框时,继续获取php白屏死机

时间:2014-02-06 02:13:06

标签: javascript php mysql

当用户删除从echo "<a href=\"delete.php?sqluid=".$row[sqluid]."\"><img title='Delete Row' alt=\"Delete\" class='del' src='images/delete.png'/></a></form></div>\n";语句完成的条目时,我正在尝试创建一个确认框。尝试使用“onlick”运算符和一些将href重定向到delete语句的javascript。尝试了我在这个网站上找到的6种不同的代码,但我不认为我正确地实现了它。当我检查php日志时,不断得到一个未定义的常量错误

<?php

//Get database credentials
require 'config.php';

// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');

require 'header.php';

$query = "SELECT * FROM ring29 ORDER BY `ring29`.`ospfarea`,`dot1q`,`subnethost` ASC;";

$result = mysql_query($query) or die(mysql_error());

//Count the number of rows returned
$count = mysql_num_rows($result);

//Table header
echo "<div><table id=\"tableheader\" bgcolor=\"#4382b5\">\n";
echo "<tr>\n";
echo "<td>&nbsp;         Sql UID...........</td>\n";
echo "<td>&nbsp;  Market:</td>\n";
echo "<td>&nbsp;      Market Code:</td>\n";
echo "<td>&nbsp;  OSPF Area:</td>\n";
echo "<td>&nbsp;  Primary Tag:</td>\n";
echo "<td>&nbsp;  802.1Q:</td>\n";
echo "<td>&nbsp;  Subnet/Host:</td>\n";
echo "<td>&nbsp; IPv6 Subnet/Host:</td>\n";
echo "<td>&nbsp;Slot/Port:</td>\n";
echo "<td>&nbsp;CMTS GW Node:</td>\n";
echo "<td>&nbsp;Slot/Port:</td>\n";
echo "<td>&nbsp;IPv6 Subnet/host:</td>\n";
echo "<td>&nbsp;Subnet/Host:</td>\n";
echo "<td>&nbsp;802.1Q:</td>\n";
echo "<tr>";
echo "</table></div>";
if ($count !== 0) {
                        while($row = mysql_fetch_array($result)) {
                                echo "<div class=\"addform\"><form method='get' action=\"update.php\">\n";
                                echo "  <input type=\"text\" value=\"".$row[sqluid]."\" name=\"sqluid\">\n";
                                echo "  <input type=\"text\" name=\"market\" value=\"".$row[market]."\"/>\n";
                                echo "  <input type=\"text\" name=\"mktcode\" value=\"".$row[mktcode]."\"/>\n";
                                echo "  <input type=\"text\" name=\"ospfarea\" value=\"".$row[ospfarea]."\"/>\n";
                                echo "  <input type=\"text\" name=\"primarytag\" value=\"".$row[primarytag]."\"/>\n";
                                echo "  <input type=\"text\" name=\"dot1q\" value=\"".$row[dot1q]."\"/>\n";
                                echo "  <input type=\"text\" name=\"subnethost\" value=\"".$row[subnethost]."\"/>\n";
                                echo "  <input type=\"text\" name=\"ipv6subnethost\" value=\"".$row[ipv6subnethost]."\"/>\n";
                                echo "  <input type=\"text\" name=\"slotport\" value=\"".$row[slotport]."\"/>\n";
                                echo "  <input type=\"text\" name=\"cmtsgwnode\" value=\"".$row[cmtsgwnode]."\"/>\n";
                                echo "  <input type=\"text\" name=\"slotport1\" value=\"".$row[slotport1]."\"/>\n";
                                echo "  <input type=\"text\" name=\"ipv6subnethost1\" value=\"".$row[ipv6subnethost1]."\"/>\n";
                                echo "  <input type=\"text\" name=\"subnethost1\" value=\"".$row[subnethost1]."\"/>\n";
                                echo "  <input type=\"text\" name=\"dot1q1\" value=\"".$row[dot1q1]."\"/>\n";
                                echo "  <input type=\"image\" src=\"images/update.png\" alt=\"Update Row\" class=\"update\" title=\"Update Row\">\n";
                                echo "<a href=\"delete.php?sqluid=".$row[sqluid]."\"><img title='Delete Row' alt=\"Delete\" class='del' src='images/delete.png'/></a></form></div>\n";
                    }
                echo "</table><br />\n";
        } else {
                echo "<b><center>NO DATA</center></b>\n";
        }
        echo "<div>Add Row:</div>\n";
        echo "<div class=\"addform\"><form method='get' action=\"add.php\">\n".
        "       <input type=\"text\" name=\"sqluid\" value=\"Enter unique number\"/>\n".
        "       <input type=\"text\" name=\"market\"/>\n".
        "       <input type=\"text\" name=\"mktcode\"/>\n".
        "       <input type=\"text\" name=\"ospfarea\"/>\n".
        "       <input type=\"text\" name=\"primarytag\"/>\n".
        "       <input type=\"text\" name=\"dot1q\"/>\n".
        "       <input type=\"text\" name=\"subnethost\"/>\n".
        "       <input type=\"text\" name=\"ipv6subnethost\"/>\n".
        "       <input type=\"text\" name=\"slotport\"/>\n".
        "       <input type=\"text\" name=\"cmtsgwnode\"/>\n".
        "       <input type=\"text\" name=\"slotport1\"/>\n".
        "       <input type=\"text\" name=\"ipv6subnethost1\"/>\n".
        "       <input type=\"text\" name=\"subnethost1\"/>\n".
        "       <input type=\"text\" name=\"dot1q1\"/>\n".
        "       <input type=\"image\" src=\"images/add.png\" alt=\"Add Row\" class=\"update\" title=\"Add Row\">\n".
        "</form></div>";
?>
<div>
<br />
<b>Legend:</b>
<br />
<img alt="Add" src="images/add.png"> Add a row after entering the correct information.<br />
<img alt="Update" src="images/update.png"> Update a row after editing it.<br />
<img alt "Delete" src="images/delete.png"> Delete a row.<br />
<br />

<form method="get" action="http://<ip address removed>">
<button type="submit">Back</button>
</form>



</div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

$ row [sqluid]应该是$ row ['sqluid'],并且在构建输入元素时还有几个更像它。