Added script to check value of previous page