这个页面运行正常,它保存到db,因为它应该突然停止回显到下一页。 你可以看到我有一个和我的PHP我有if($ query){
//如果查询成功
回声'';这已经奏效但现在突然因某些原因停止了工作。
请帮忙!
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Inctive</title>
<meta name="description" content="Welcome to our demo application.">
<link rel="stylesheet" href="css/nav.css">
</head>
<?php
//include database configuration
$dbhost = "127.0.0.1";
$dbuser = "root";
$dbpass = "root";
$dbname = "inctive";
$conn = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname) or die ('Error connecting to mysql');
if(isset($_POST['save'])){
extract($_REQUEST);
//sql insert statement
$query=mysqli_query($conn,"insert into identifyRisk SET
referenceNumber='$referenceNumber',
riskName='$riskName',
riskDescription='$riskDescription',
division='$division',
businessUnit='$businessUnit',
location='$location',
businessObjective='$businessObjective',
perspective='$perspective',
identifiedBy='$identifiedBy'
") or die(mysqli_error($conn));
//insert query to the database
if($query){
//if successful query
echo '<a href="analyseRisk.php">';
}
}
?>
<body>
<div id="wrapper">
<header style="margin-left: 3px;">
<nav id="coreMenu">
<ul>
<li><img src="images/AssureantLogo.jpg" class="logoMenu"></li>
<li><a href="administrationAndSecurity">Administration & Security</a></li>
<li><a href="governance">Governance</a></li>
<li><a href="selectRisk.php">Risk</a></li>
<li><a href="compliance">Compliance</a></li>
<li style="float:right; background-color: #66b0d1; margin-right: 5px;"><a href="signIn">Log Out - User: dein</a></li>
</ul>
</nav>
<label class="headlinePage">Identify Risk</label>
</header>
<section class="tableBackground">
<form action="#" method="post">
<table class="insertField">
<tbody>
<tr>
<td class="inputFieldHeadline">
<label for="referenceNumber">Reference Number:</label>
</td>
<td class="inputFieldField">
<input type="text" id="referenceNumber" name="referenceNumber" placeholder="Will be auto generated">
</td>
</tr>
<tr>
<td class="inputFieldHeadline">
<label for="riskName">Risk Name:</label>
</td>
<td class="inputFieldField">
<input type="text" id="riskName" name="riskName" placeholder="Enter Risk Name" >
</td>
</tr>
<tr>
<td class="inputFieldHeadline">
<label for="riskDescription">Risk Description:</label>
</td>
<td class="inputFieldField">
<input type="text" id="riskDescription" name="riskDescription" placeholder="Enter Risk Description">
</td>
</tr>
<tr>
<td class="inputFieldHeadline">
<label for="division">Division:</label>
</td>
<td class="inputFieldField">
<input type="text" id="division" list="divisionList" name="division" placeholder="Please Select">
<datalist id="divisionList">
<option value="First" />
<option value="Second" />
<option value="Third" />
<option value="Fourth" />
<option value="Fifth" />
</datalist>
</td>
</tr>
<tr>
<td class="inputFieldHeadline">
<label for="businessUnit">Business Unit:</label>
</td>
<td class="inputFieldField">
<input type="text" id="businessUnit" list="businessUnitList" name="businessUnit" placeholder="Please Select">
<datalist id="businessUnitList">
<option value="First of 1" />
<option value="Second of 1" />
<option value="Third of 1" />
<option value="Fourth of 1" />
<option value="Fifth of 1" />
</datalist>
</td>
</tr>
<tr>
<td class="inputFieldHeadline">
<label for="location">Location:</label>
</td>
<td class="inputFieldField">
<input type="text" id="location" list="locationList" name="location" placeholder="Please Select">
<datalist id="locationList">
<option value="Brisbane" />
<option value="Gold Coast" />
<option value="Sydney" />
<option value="Darwin" />
<option value="Perth" />
</datalist>
</td>
</tr>
<tr>
<td class="inputFieldHeadline">
<label for="businessObjective">Business Objective:</label>
</td>
<td class="inputFieldField">
<input type="text" id="businessObjective" list="businessObjectiveList" name="businessObjective" placeholder="Please Select">
<datalist id="businessObjectiveList">
<option value="First Objective" />
<option value="Second Objective" />
<option value="Third Objective" />
<option value="Fourth Objective" />
<option value="Fifth Objective" />
</datalist>
</td>
</tr>
<tr>
<td class="inputFieldHeadline">
<label for="perspective">Perspective:</label>
</td>
<td class="inputFieldField">
<input type="text" id="perspective" name="perspective" placeholder="Enter Perspective" >
</td>
</tr>
<tr>
<td class="inputFieldHeadline">
<label for="identifiedBy">Identified by:</label>
</td>
<td class="inputFieldField">
<input type="text" id="identifiedBy" name="identifiedBy" placeholder="Verify your name!">
</td>
</tr>
</tbody>
</table>
<div class="nextPrevButton">
<!--
<input type="button" name="b1" value="next" onclick="location.href='next_pare.html'">
-->
<input type="submit" name="save" value="Next">
</div>
</form>
</section>
</div>
<!-- Might not be used but is good to have it here -->
<!--
<footer>
<p>Some copyright or nothing</p>
</footer>
-->
</div>
</body>
</html>
答案 0 :(得分:1)
尝试关闭制造商 a
if($query){
//if successful query
echo '<a href="analyseRisk.php">analyseRisk</a>';
}
答案 1 :(得分:1)
我不确定你想要实现什么,但是echo代码有些问题:
echo '<a href="analyseRisk.php">';
如果您想要链接,那么您应该这样做
echo '<a href="analyseRisk.php">click here please</a>';
如果你想自动重定向到analyseRisk.php那么
header("Location: analyseRisk.php");
答案 2 :(得分:1)
只需关闭锚标记
即可<a hre='/whateverUrl' >Click Here</a>
答案 3 :(得分:1)
关闭echo中的锚标记
echo '<a href="analyseRisk.php">Something..</a>';