我是新手,但我需要帮助看看我哪里出错了。这是我尝试过的代码:
<td>:</td>
<td><input name="lastname" type="text" ></td>
</tr>
<tr>
<td>Details</td>
<td>:</td>
<td><input name="details" type="text" ></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
这是用于处理和输入数据库的 PHP 页面:
<?php
$name=$_REQUEST['name'];
$lastname=$_REQUEST['lastname'];
$details=$_REQUEST['details'];
//connect to Database
$link = new mysqli("localhost", "name", "pass", "DB");
//check connection
if (!$Link){
printf("Connect Failed: %s/n", mysqli_connect_error());
exit();
}
//turn auto commit off
mysqli_autocommit($link,FALSE);
mysqli_query ($link,"INSERT INTO IncidentDatabase (First_Name, Last_Name,Inciden_Details) VALUES ('$name','$lastname','$details')");
/* commit transaction */
mysqli_commit($link);
/* close connection */
mysqli_close($link);
?>