且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP中的验证时间

更新时间:2023-02-26 18:26:45

time =


_POST [ time_tlp];

menit =

i dont can to validation time, i use 3 text box, for hours, minutes, seconds

What I have tried:

$time=$_POST["time_tlp"];
	$menit=$_POST["menit_tlp"];
	$detik=$_POST["detik_tlp"];
	$jam_tlp = $_POST['time_tlp'].':'.$_POST['menit_tlp'].':'.$_POST['detik_tlp'];



if (isset($_POST['time_Tlp']  ) == ""  || !is_numeric($_POST['time_Tlp'])	|| ($_POST['time_Tlp'])>=23 ){
echo "<script>alert(' format jam salah ');window.history.go(-1);</script>";}
// $time = ( $_POST['jam_tlp'] );


elseif (isset($_POST['menit_tlp'] ) == ""  || !is_numeric($_POST['menit_tlp']) || ($_POST['menit_tlp'])>=59){
echo "<script>alert(' format menit salah ');window.history.go(-1);</script>";}
//$menit = ( $_POST['menit_tlp'] );



elseif (isset($_POST['detik_tlp'] ) == ""  || !is_numeric($_POST['detik_tlp']) || ($_POST['detik_tlp'])>=59){
echo "<script>alert(' format detik salah ');window.history.go(-1);</script>";}
	//$detik = ( $_POST['detik_tlp'] );

time=


_POST["time_tlp"];


menit=