Created
March 27, 2013 10:07
-
-
Save phpfiddle/5253162 to your computer and use it in GitHub Desktop.
simple form state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_POST['kelas'] = isset($_POST['kelas']) ? $_POST['kelas'] : 0; // this line removes notices (ignore this) | |
$_POST['tahun'] = isset($_POST['tahun']) ? $_POST['tahun'] : 0; // this line removes notices (ignore this) | |
?> | |
<form method='post'> | |
<select name='kelas'> | |
<option value=0>Pilih kelas</option> | |
<option value=1 <?php if($_POST['kelas']==1) echo 'selected' ?> >X-1</option> | |
<option value=2 <?php if($_POST['kelas']==2) echo 'selected' ?> >X-2</option> | |
<option value=3 <?php if($_POST['kelas']==3) echo 'selected' ?> >X-3</option> | |
</select> | |
<select name='tahun'> | |
<option value=0>Pilih tahun</option> | |
<option value=2012 <?php if($_POST['tahun']==2012) echo 'selected' ?> >2012/2013</option> | |
<option value=2011 <?php if($_POST['tahun']==2011) echo 'selected' ?> >2011/2012</option> | |
<option value=2010 <?php if($_POST['tahun']==2010) echo 'selected' ?> >2010/2011</option> | |
</select> | |
<input type='submit' name='submit' /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment