Advertisement
citstudio

Simpan dengan Pesan

May 2nd, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. form.php
  2. <?php
  3.     if (isset($_GET["msg"])){
  4.         if ($_GET["msg"]=="true"){
  5.             echo "Data Tersimpan nomor: ". $_GET["nomor"];
  6.         }else{
  7.             echo "GAGAL";
  8.         }
  9.     }
  10. ?>
  11. <form action="save.php" method="post">
  12.     <input type="text" name="nomor" value="001"/>
  13.     <input type="submit" name="simpan" value="Simpan"/>
  14. </form>
  15.  
  16. save.php
  17.  
  18. <?php
  19. $sql = mysql_query("INSERT INTO...");
  20. if($sql){
  21. // jika tersimpan
  22.     header("location:form.php?msg=true&nomor=".$_POST["nomor"]);
  23. }else{
  24.     header("location:form.php?msg=false);
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement