專案資料新增
dbconnect();
/*
The SQL statment to insert a new project into the database is constructed
here based upon the values obtained from the form elements in the form at
the bottom of this html page which are passed as properties of the REQUEST object.
*/
companies = database.cursor("SELECT * FROM companies ORDER BY companyname")
if(request.projectname && request.companyname) {
projectexists = database.cursor("SELECT * FROM project WHERE projectname = '" + request.projectname + "'")
if(!projectexists.next()) {
database.execute("insert into project values ('" +
request.projectname + "','" +
request.companyname + "','" +
request.techdesc + "')")
redirect("viewproj.html?project=" + escape(request.projectname))
}else {
write(" 專案名稱已存在,請選擇使用其它名稱.")
}
}