/* Check to make sure we are connected to the database before allowing access to the home page. If not connected, go connect and initialize; otherwise, welcome the user.\ */ if(!database.connected()) redirect("init.htm"); idcursor = database.cursor("select plan_id from benefit_plan order by plan_id"); while (idcursor.next()) { client.last_id = idcursor.plan_id; } client.new_id = parseInt(client.last_id,10); client.new_id++; project.lock(); database.execute("insert into benefit_plan (plan_id, plan_descp, plan_cost) values (" + client.new_id + ", '" + request.descp + "', '" + request.cost + "')"); project.unlock(); redirect("plans.htm")