-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaddtest_ajax.php
29 lines (24 loc) · 958 Bytes
/
addtest_ajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include("dbaseconnection.php");
require_once("auth.php");
$id=$_SESSION['SESS_MEMBER_ID'];
$sql=mysql_query("select labname from lablist where id='$id'");
$row=mysql_fetch_row($sql);
$lname=$row[0];
$tname=$_POST['tname'];
$rate=$_POST['rate'];
$counter=$_POST['counter'];
$tname = strtoupper($tname);
$sql3=mysql_query("select tname from testnames where tname='$tname' and labname='$lname'");
if($out=mysql_fetch_row($sql3)){
echo'<h3 style="color:red;">';
echo'('.$counter.') New test addition unsuccessful.<br />Test already exists.<br>Please click <a style="color:green;text-decoration: underline;"href="edittest.php">here</a> to change its rate.</br>';
echo'</h3>';
}
else{
$sql=mysql_query("INSERT INTO testnames(tname,labname,rate) VALUES ('$tname','$lname','$rate')");
echo'<h3 style="color:green;">';
echo'('.$counter.') New test added successfully.<br>Thank you for collaborating with us.</br>';
echo'</h3>';
}
?>