if ( ! empty($_POST) )

e poi sotto

<?php if(isset($mex)) echo $mex;?>