changed server code to post to db