[insert_php]
session_start();
$servername = “biosensource.com.mysql”;
$username = “biosensource_co”;
$password = “MffkiPQQ”;
$con = mysqli_connect($servername, $username, $password);
$submissionTS = date(“Y-m-d H:i:s”, strtotime(“+2 hour”));
$requestDB = mysqli_query($con, “SELECT * FROM `biosensource_co`.`requests`”);
/*echo ‘
'; print_r($requestDB); echo '
‘;*/
$ID = mysqli_num_rows($requestDB);
$ID = $ID+1;
$error=””;
$title= $_POST[“title”];
$sender=$_SESSION[“user”];
$request= $_POST[“request”];
$receiver= $_POST[“receiver”];
if (strlen($title)<1|strlen($request)<1|strlen($sender)<1|strlen($receiver)<1){ $error .= "
Fill out all fields.”; };
if ($error !=”){
echo “error: ” . $error;
}
else {
$sql = “INSERT INTO `biosensource_co`.`requests` (`ID`, `sender`, `receiver`, `title`, `request`, `submission date`, `current status`) VALUES (‘$ID’, ‘$sender’, ‘$receiver’, ‘$title’, ‘$request’, ‘$submissionTS’, ‘open’);”;
if (mysqli_query($con,$sql)){
echo “Request successfully registered on ” . $submissionTS . ”
“;
}
else {echo “Request not registered. Please try again or contact support.”; }
}
[/insert_php]