Trying to figure out the php and javascript issues