2 deleted 85 characters in body
source | link

Use this code

<?php
    if(isset($_REQUEST['submit_btn']))
    {
       echo "<div>";
       $name = $_POST["names"];
       echo "</div>";
       $ins="insert into tablename (fieldname)values('$name') ";                
       $conn->query($ins);
       ?>
       <script>
       alert('inserted successfully');
       </script>
       <?php
          $sel="select * from tablename";
          $r=$conn->query($sel);
          while($u=$r->fetch_object())
          {
       ?>
          <tr>
             <td><?php echo $u->fieldname;?></td>
          </tr><?php
          }
    }
?>

<form action="" method="POST">
   <input type="text" name="names" id="names">
   <input type="submit" value="submit" name="submit_btn">
</form>

Hope this will help you

Use this code

<?php
    if(isset($_REQUEST['submit_btn']))
    {
       echo "<div>";
       $name = $_POST["names"];
       echo "</div>";
       $ins="insert into tablename (fieldname)values('$name') ";                
       $conn->query($ins);
       ?>
       <script>
       alert('inserted successfully');
       </script>
       <?php
          $sel="select * from tablename";
          $r=$conn->query($sel);
          while($u=$r->fetch_object())
          {
       ?>
          <tr>
             <td><?php echo $u->fieldname;?></td>
          </tr><?php
          }
    }
?>

<form action="" method="POST">
   <input type="text" name="names" id="names">
   <input type="submit" value="submit" name="submit_btn">
</form>

Hope this will help you

Use this code

<?php
    if(isset($_REQUEST['submit_btn']))
    {
       echo "<div>";
       $name = $_POST["names"];
       echo "</div>";
       $ins="insert into tablename (fieldname)values('$name') ";                
       $conn->query($ins);
       ?>
       <script>
       alert('inserted successfully');
       </script>
       <?php
          $sel="select * from tablename";
          $r=$conn->query($sel);
          while($u=$r->fetch_object())
          {
      echo $u->fieldname;
          }
    }
?>

<form action="" method="POST">
   <input type="text" name="names" id="names">
   <input type="submit" value="submit" name="submit_btn">
</form>

Hope this will help you

1
source | link

Use this code

<?php
    if(isset($_REQUEST['submit_btn']))
    {
       echo "<div>";
       $name = $_POST["names"];
       echo "</div>";
       $ins="insert into tablename (fieldname)values('$name') ";                
       $conn->query($ins);
       ?>
       <script>
       alert('inserted successfully');
       </script>
       <?php
          $sel="select * from tablename";
          $r=$conn->query($sel);
          while($u=$r->fetch_object())
          {
       ?>
          <tr>
             <td><?php echo $u->fieldname;?></td>
          </tr><?php
          }
    }
?>

<form action="" method="POST">
   <input type="text" name="names" id="names">
   <input type="submit" value="submit" name="submit_btn">
</form>

Hope this will help you