<?php
session_start();

if (isset($_POST['content'])and isset($_POST['id'])) {
	
	include ("../includes/db.php");
	$userId = $_SESSION['id'];
	
	$pgid = mysql_escape_string($_POST['id']);
	$content = mysql_escape_string($_POST['content']);
	
	
	// INSER NOTE
	$query = "INSERT INTO note (PageId, Content) VALUES ('$pgid', '$content') ";
	mysql_query ($query);
	
	// INSERT USER_PAGE_NOTE
	$noteId = mysql_insert_id();
	$query = "INSERT INTO user_note (UserId, NoteId) VALUES ('$userId', '$noteId') ";
	mysql_query ($query);
	
	
	echo "success";
}

?>