updated flag and $_Post['data']. The second part is not finished yet