Skip to main content

session to send a text or data

db.php
_____________________________________________________
<?php 
$query=mysql_query("INSERT INTO employee VALUES ('$id','$name')");
if($query) {
     $_SESSION['msg']="inserted successfully";
     header('location:index.php');
}?>
_____________________________________________________


index.php
_____________________________________________________

<?php if (isset($_SESSION['msg'])) { ?>
      <div class="alert alert-info">
           <?php echo $_SESSION['msg'];?>
      </div>
<?php unset($_SESSION['msg']);   }  ?>
_____________________________________________________

Comments

Popular posts from this blog

HTML 5 pattern validation

<!DOCTYPE html> <html> <head> <title>html5 patterns val</title> </head> <body> <form action=""> Email :   <input type="email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" required> Min Char:  <input type="password" name="pw" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters" required> Search: <input type="search" name="search" pattern="[^'\x22]+" title="Invalid input" required> Password:   <input type="password" name="pw" pattern=".{6,}" title="Six or more characters" required> Country code: <input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three let...