<?php 
session_start();
//mysql_connect("localhost","root","vertrigo") or die("Error Connecting Server");
//mysql_select_db("sm") or die("Error Opening Database");
include 'dbc.php';

$userid=$_SESSION["userid"];
$id=$_REQUEST["id"];
$today=date("Y-m-d");

 $sqlp14 = "select * from qu where id='$id' and user_id='$userid'";
 							$finishstock=mysql_query($sqlp14) or die("Error : " . mysql_error());
   							$app1=mysql_fetch_array($finishstock);
   							$class_name=$app1["class_name"];
							$sub_name=$app1["sub_name"];
							$p_type=$app1["p_type"];
							$question=$app1["question"];
							$optionn=$app1["optionn"];


$sqll = "select * from qu where id='$id' and user_id='$userid'";
$data=mysql_query($sqll) or die ("Error:" . mysql_error());
$rows=mysql_num_rows($data);
$user_data=mysql_fetch_array($data);

  if($rows==0)
    {
	   $Message =  "This Record Cannot Deleted";
	    header("Location:enter_question_paper_report.php?Message={$Message}");
	  }
	  else
	  {
	  

$sql2 = "Insert into add_paper (id,date,class_name,sub_name,p_type,question,optionn,user_id)values (null,'$today','$class_name','$sub_name','$p_type','$question','$optionn','$userid')";

mysql_query($sql2) or die("Error : " . mysql_error());


$Message = "Record Saved";
    header("Location:enter_question_paper_report.php?Message={$Message}");
}
/*$sql="Select * from agents where userid='$user_id'";
$data=mysql_query($sql) or die ("Error:" . mysql_error());
$userdata=mysql_fetch_array($data);
$email=$userdata["e_mail"];
mail($email . ",info@lalburj.com","Candidate Information","Candidate Data Posted Successfully","Passport No:" . $app_pp_no . " of " . $app_name . "Has been Posted Successfully By:" . $_SESSION["userid"]);*/
?>
