php - how to get variable from multipe forms when one of them already submit -
i have 2 form
<form name='theform' id='theform' method="post">
and
<form id="frmdate" action="?page=absensi" method="post">
i submit first form this
<input type="radio" name="keterangan" value="hadir" onchange="theform.submit();" />
second form this
<script type="text/javascript"> jquery(function(){ $('#tgl').daterangepicker({ arrows:true, onchange: function(){ $('#frmdate').submit(); }//removed comma here }); }); </script>
i can variable 1 of forms this
<?php $keterangan = ""; $date1 = ""; $date2 = ""; if(isset($_post["keterangan"])){ $keterangan = $_post["keterangan"]; } elseif(isset($_post["tgl"])){ $dates = explode("-",$_post[tgl] ); $date1= date("y-m-d", strtotime($dates[0])); if ($dates[0] == $_post[tgl]){ $date2 = $date1; } else{ $date2= date("y-m-d", strtotime($dates[1]));} } ?>
but don't know how variable forms when 1 of them submit. have try manipulate code this:
<?php if(isset($_post["keterangan"])){ $keterangan = $_post["keterangan"]; if(isset($_post["tgl"]) , $keterangan<>''){ $dates = explode("-",$_post[tgl] ); $date1= date("y-m-d", strtotime($dates[0])); if ($dates[0] == $_post[tgl]){ $date2 = $date1; } else{ $date2= date("y-m-d", strtotime($dates[1]));} } } elseif(isset($_post["tgl"])){ $dates = explode("-",$_post[tgl] ); $date1= date("y-m-d", strtotime($dates[0])); if ($dates[0] == $_post[tgl]){ $date2 = $date1; } else{ $date2= date("y-m-d", strtotime($dates[1]));} if(isset($_post["keterangan"]) , $date1<>'' , $date2<>''){ $keterangan = $_post["keterangan"];} } ?>
please me out problem. thanks
use 1 form instead of 2 separated , handle cases on backend. can't read state of 1 form if submitted.
Comments
Post a Comment