<? $no_ref=$_POST['no_referensi']; $ref='/^([000-999])*-([000-999])$/'; if (!preg_match($ref,$no_ref)) { print "<script>alert('Maaf, Format Nomor Salah'); javascript:history.go(-1);</script>"; }else { print"Selamat.."; } ?>