Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Undefined index: btnaction

Links for php scripts

Moderators: macek, egami, gesf

Undefined index: btnaction

Postby riagil14 » Thu Dec 19, 2013 2:55 am

Hello Evey body, I'm newbie, I have some error :

Notice: Undefined index: btnaction in C:\xampp\htdocs\Sinau\tampildata.php on line 5

this is my code :
Code: Select all
 if($_POST['btnaction'] == "Edit")
   $id = $_POST['id'];
   $page = "editdata.php?id=".$id;
   echo redirectPage($page);
           <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
           <title>PHP Dasar 3 - Koneksi Database MySQL dan Menampilkan Data</title>
     <script type="text/javascript">
      function konfirmasiHapus(id,username)
         var id = id;
         var username = username;
         var jawab;
         jawab = confirm("Apakah data '"+username+"' akan dihapus ?")
            window.location = "hapusdata.php?id="+id;
            return false;
            alert("Penghapusan data dibatalkan");
         <table border="1" align="center">
          <th>Tgl Lahir</th>
              $sql = "SELECT * FROM data_php";
              $hasil = mysql_query($sql);
              if(mysql_num_rows($hasil) > 0)
                  while($data = mysql_fetch_array($hasil))
                     echo"<form action='' method='post'>";
                        echo"<input type='hidden' name='id' value='".$data['id']."'>";
                        echo"<input type='submit' name='btnaction' value='Edit'>";
                        echo"<input type='submit' name='btnaction' onclick=\"return konfirmasiHapus('".$data['id']."','".$data['username']."');\" value='Hapus'>";
                         echo"<td colspan='4'>Data Belum Ada</td>";

Help me please... :D
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Dec 19, 2013 2:48 am

Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.