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
30
31
32
33
34
|
<?php require("configure.php"); ?> <? $hotcourse = $_POST["hotcourse"]; $ccatnameen = htmlspecialchars($_POST["ccatnameen"],ENT_QUOTES); $ccatdescen = preg_replace("/'/","\'",$_POST["ccatdescen"]); $ccatnametc = htmlspecialchars($_POST["ccatnametc"],ENT_QUOTES); $ccatdesctc = preg_replace("/'/","\'",$_POST["ccatdesctc"]); $cstyleid = $_POST["cstyleid"]; $cpref = $_POST["orderno"]; //print_r($_POST);
$sql = "select max(ccatid) as maxid "; $sql .= "from coursecat "; $result=mysql_query($sql); $row = mysql_fetch_array($result,MYSQL_ASSOC); $ccatid = $row{maxid}+1;
if ($_FILES['hotcourseimg']['name'] <> '') { copy ($_FILES['hotcourseimg']['tmp_name'], "hotcourseimg/".$ccatid.$_FILES['hotcourseimg']['name']) or die ("Could not copy"); $hotcourseimg = $ccatid.$_FILES['hotcourseimg']['name']; } else { $hotcourseimg = ""; }
mysql_query("insert into coursecat (ccatid, ccatnameen, ccatdescen, ccatnametc, ccatdesctc, cstyleid, hotcourse, hotcourseimg, pref) values ('$ccatid', '$ccatnameen', '$ccatdescen', '$ccatnametc', '$ccatdesctc', '$cstyleid', '$hotcourse', '$hotcourseimg',$cpref)"); mysql_close($dbh);
header("Location: coursecatindex.php?msg=Update Successful"); ?>
|