This is my php coding. I got this from my template form.
The weirdest thing is, when I try to run this coding from my template I've got the ouput and it retrieved the data, but when I try to running this coding into my project assignment it come out with the blank page.
<?php
include"conn.php";
$conn = connect();
$db = connectdb();
$wardID =$_REQUEST["wardID"];
$RequestName = $_REQUEST["RequestName"];
$Department =$_REQUEST["Department"];
$Position = $_REQUEST["Position"];
$Date = $_REQUEST["Date"];
$TypeOfRequest = $_REQUEST["TypeOfRequest"];
$PleaseSpecify = $_REQUEST["PleaseSpecify"];
$DateRequire = $_REQUEST["DateRequire"];
$DateReturn = $_REQUEST["DateReturn"];
mysqli_select_db($conn,"misadmin") or die (mysqli_connect_error()."\n");
//select from the table student
$query = "select * from misform" ;
//to return the query that has been request from the database
$result = $conn ->query($query);
//Fetch a result row as an associative array
$row=mysqli_fetch_assoc($result);
//Select a MySQL database
mysqli_select_db($conn,"misadmin")or die (mysqli_connect_error()."\n");
$insert ="insert into misform(WardID,RequestName,Department,Postion,Date,TypeOfRequest,PleaseSpecify,DateRequire,DateReturn) values ('$wardID','$RequestName','$Department','$Position','$Date','$TypeOfRequest','$PleaseSpecify','$DateRequire','$DateReturn')";
$rowinsert =$conn ->multi_query($insert) or die (mysqli_connect_error()."\n");
header("Location:requestform3.php");
?>
here is my connection
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$host_user="localhost";
$user_user="root";
$password_user="";
function connect (){
$conn =mysqli_connect("localhost","root","") or die (mysqli_connect_error()."/n");
return $conn;
}
function connectdb(){
$conndb="misadmin";
return $conndb;
}
?>
</body>
</html>
here is my html
<body>
<form id="requestform" action="requestform2.php" method="post" >
<div><center><table border = "0" cellspacing="0" cellpadding"4"><tr><td>
<fieldset>
<legend>Request Form</legend>
<div id="errorDiv"></div>
<table><tr>
<td><label for="wardID">Ward ID:*</label></td>
<td><input type="text" id="wardID" name="wardID">
<span class="errorFeedback errorSpan" id="WardIDError"> Ward ID is required</span></td>
</tr>
<tr>
<td><label for="RequestName">Request Name:</label></td>
<td><input type="text" id="RequestName" name="RequestName"></td>
</tr>
<tr>
<td><label for="Department">Department:</label></td>
<td><input type="text" id="Department" name="Department"></td>
</tr>
<tr>
<td><label for="Position">Position:</label></td>
<td><input type="text"id="Position" name="Position"></td>
</tr>
<tr>
<td><label for="Date">Date:</label></td>
<td><input type="date" id="Date" name="Date"></td>
</tr>
<tr>
<td><label for="request">Type of request:* </label></td>
<td><select name="TypeOfRequest" id="request">
<option></option>
<option>Hardware</option>
<option>Software</option>
<option>Network</option>
<option>Others</option></select>
<span class="errorFeedback errorSpan" id="requestError">Please choose one</span>
</td></tr>
<tr>
<td></td>
<td><textarea name="PleaseSpecify" id="specify"> Please Specify </textarea>
<span class="errorFeedback errorSpan" id="specifyError">you not specify yet!</span>
</td></tr>
<tr>
<td><label for="DateRequire">Date Require:</label></td>
<td><input type="date" id="DateRequire" name="DateRequire">
</td></tr>
<tr>
<td><label for="DateReturn">Date Return:</label></td>
<td><input type="date" id="DateReturn" name="DateReturn">
</td></tr>