<?php
session_start();
$username = $_SESSION['membership'];
include("connect.php");
$sowner = $_POST["ID"];
$scomment = $_POST["scomment"];
$date = date("Y-m-d H:m:s"); 
	
if($_POST["Delete"] == "Delete")
	{
	$result = mysql_query("delete from spacemessage where memLname='$ISBN' && memLname = '$username'");
	$db = mysql_close();
	echo "<script language='javascript'>alert('Your comment is deleted.')</script>";
	echo "<script language='javascript'>window.location='bookviewpage.php?ISBN=$ISBN'</script>";
}else{
	$result = mysql_query("INSERT INTO spacecomment(sowner,memLname,scomment,stime)
	VALUES
	('$sowner','$username','$scomment','$date')");
	$db = mysql_close();
	echo "<script language='javascript'>alert('Thanks for your comment.')</script>";
	echo "<script language='javascript'>window.location='personalspace.php?membername=$sowner'</script>";
}

?>