<form action="form.php" method="post">
nama :<input type="text" name="nama"/>
kelas :<input type="text" name="kelas"/>
<input type="submit" name="submit" value="submit"/>
</form>
<?php
if(isset($_POST['nama']) && isset($_POST['kelas'])){
$nama = $_POST['nama'];
$kelas = $_POST['kelas'];
mysql_connect("localhost","root","");
mysql_select_db("validasiform");
$kirim = mysql_query("insert into form(nama, kelas) values('$nama','$kelas')");
if($kirim) echo "tersimpan di database";
}
?>
<form action="form.php" method="post">
nama :<input type="text" name="nama"/>
kelas :<input type="text" name="kelas"/>
<input type="submit" name="submit" value="submit"/>
</form>
<?php
if(isset($_POST['nama']) && isset($_POST['kelas'])){
$nama = $_POST['nama'];
$kelas = $_POST['kelas'];
mysql_connect("localhost","root","");
mysql_select_db("validasiform");
$kirim = mysql_query("insert into form(nama, kelas) values('$nama','$kelas')");
?>
<script type="text/javascript">
window.alert("tersimpan di database");
window.history=back(-1);
</script>
<?php
}
?>
<form action="form.php" method="post">
nama :<input type="text" name="nama"/>
kelas :<input type="text" name="kelas"/>
<input type="submit" name="submit" value="submit"/>
</form>
<?php
if(isset($_POST['nama']) && isset($_POST['kelas'])){
$nama = $_POST['nama'];
$kelas = $_POST['kelas'];
mysql_connect("localhost","root","");
mysql_select_db("validasiform");
$kirim = mysql_query("insert into form(nama, kelas) values('$nama','$kelas')");
?>
<script type="text/javascript">
window.alert("tersimpan di database");
window.location.href = 'form.php';
</script>
<?php
}
?>