Kod
<script type="text/javascript">
$(document).ready(function(){
$("form").submit(function(){
$(this).children( 'input[name="gospodarze"]').val() == '' ? $(this).children( 'input[name="gospodarze"]').css( 'background', '#EF9595' ) : $(this).children( 'input[name="gospodarze"]').css( 'background', '#FFFFFF' );
$(this).children( 'input[name="goscie"]').val() == '' ? $(this).children( 'input[name="goscie"]').css( 'background', '#EF9595' ) : $(this).children( 'input[name="goscie"]').css( 'background', '#FFFFFF' );
$(this).children( 'input[name="miejsce"]').val() == '' ? $(this).children( 'input[name="miejsce"]').css( 'background', '#EF9595' ) : $(this).children( 'input[name="miejsce"]').css( 'background', '#FFFFFF' );
$(this).children( 'input[name="godzina"]').val() == '' ? $(this).children( 'input[name="godzina"]').css( 'background', '#EF9595' ) : $(this).children( 'input[name="godzina"]').css( 'background', '#FFFFFF' );
$.ajax({
type: "POST",
url: "ajax/term_spotkan.ajax.php",
data: { 'id': $(this).children('input[name="id"]').val(), 'gospodarze': $(this).children('input[name="gospodarze"]').val(), 'goscie': $(this).children('input[name="goscie"]').val(),'rok': $(this).children('input[name="rok"]').val(),
'miesiac': $(this).children('input[name="miesiac"]').val(), 'dzien': $(this).children('input[name="dzien"]').val(), 'miejsce': $(this).children('input[name="miejsce"]').val(),
'godzina': $(this).children('input[name="godzina"]').val(), 'wiek': $(this).children('select[name="wiek"]').val() },
success: function( msg ){
$( "#updMsg" ).text( msg );
$( "#updMsg" ).css( 'display', 'block' );
}
});
return false;
});
});
</script>
<input name="id" type="hidden" value="<?php echo $zm[ 'id_spotkania' ];?>" />
<input class="dane_zw" name="gospodarze" style="width: 120px;" type="text" value="<?php echo $zm['gospodarze'];?>" />
<input class="dane_zw" name="goscie" style="width: 100px;" type="text" value="<?php echo $zm['goscie'];?>" />
<input class="dane_zw" name="rok" style="width: 50px;" type="text" value="<?php echo $zm['rok'];?>" />
<input class="dane_zw" name="miesiac" style="width: 50px;" type="text" value="<?php echo $zm['miesiac'];?>" />
<input class="dane_zw" name="dzien" style="width: 50px;" type="text" value="<?php echo $zm['dzien'];?>" />
<input class="dane_zw" name="miejsce" style="width: 90px;" type="text" value="<?php echo $zm['miejsce'];?>" />
<input class="dane_zw" name="godzina" style="width: 50px;" type="text" value="<?php echo $zm['godzina'];?>" />
<select name="wiek" class="select_wiek"> <?php
$zm['wiek'] == 'seniorzy'? $seniorzy = 'selected' : $kadeci = 'selected';
?>
<option value="seniorzy" <?php echo $seniorzy; ?>>seniorzy
</option> <option value="kadeci" <?php echo $kadeci; ?>>kadeci
</option> <input type="submit" name="aktualizuj" value="Aktualizuj" class="submit" /> <input type="submit" name="usun" value="Usuń" class="submit" />
formularz obraca się w pętli więc kilka ich jest wyświetlanych na stronie