PHP USING NOTIFICATION
What is Push
Notification ?
A push notification is a message that pops up on a
mobile device and Desktops App publishers
can send them at any time using their
devices to receive Your Mobile or Desktop
Ex:
<html>
<head>
</head>
<body>
<table cellpadding="4">
<form method=" post " action="">
<tr><td>regno</td><td><input id=" i1" type="text " placeholder=" Enter your regno " required name=" reg "> </td> </tr>
<tr><td>name</td><td><input id=" i2 " type=" text " placeholder=" Enter your name " required name=" nm "> <br>
<tr> <td> Notfication </td> <td> <textarea id="i3" required name="t1" height="300" width="300"> </textarea> </td> </tr>
</table>
<input type=" submit " value=" send " onclick="return chk();" name="s">
</form>
</body>
</html>
<?php
// include the file
include('con1.php');
// check the submit button is clicked or not
if(isset($_POST['s'])){
$reg=$_POST['reg'];
$nm=$_POST['nm'];
$res=$_POST['t1'];
// insert the data into mysql database
$sql="INSERT INTO `mark` (`regno`,`name`,`result`) VALUES ('$reg','$nm','$res')";
$con->query($sql);
}
?>
<?php include('con1.php'); ?>
<html>
<head>
<style>#i{background-color:red;} #in {
border-top: none;
border-left: none;
border-right: none;
border-bottom: 1px solid;
box-shadow: 1px 1px;
margin-top:0px;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
padding-top: 0px;
padding-left: 0px;
padding-right: 0px;
}#in:focus {
padding: 15px;
transition: padding 0.4s;
} @media only screen and (max-width: 480px) {
.contact-details .detail {
display: block;
}
}
.card-skills {
position: relative;
}
.skill-info {
margin-left: 20px;
}
@media only screen and (min-width: 768px) {
.skill {
border-left: 9px solid #555555;
}
.skill.beginner {
height: 50%;
border-color: #e74c3c;
}
.skill.intermediate {
height: 70%;
border-color: #f1c40f;
}
.skill.advanced {
border-color: #5cb85c;
}
.skill.master {
border-color: black;
}
}
@media (max-width: 768px) {
.quote {
font-size: inherit;
}
}
@media print {
body {
font-size: 10pt;
}
a[href]:after {
content: none !important;
}
.pagebreak {
page-break-before: always;
}
.background-card h4:not(:first-child) {
margin-top: 0 !important;
}
.card {
border: 0;
padding: 0;
}
.container {
max-width: 100%;
width: 100%;
}
.contact-details .detail .icon {
color: #888 !important;
}
</style>
</head>
</html>
<form method=" post " action="">
<?php
$sql=" SELECT count(result) FROM `mark` ";
$res=$con->query($sql);
while( $row= mysqli_fetch_array($res)){
$cnt = $row['count(result)'];
if($cnt<=0){
echo "<button> Notfication( ) </button>";
}else {
?>
<input type=" submit " id= 'i' name= "sub" value= "Notfication (<?php echo $cnt; ?>)"> </button> <br>
<?php
}
}
if(isset($_POST['sub'])){
$qry="select * FROM `mark`";
$re=$con->query($qry);
while($row=mysqli_fetch_array($re)){
?>
<?php echo "<b id='i1'>".$row['result']."</b>.<br>"; ?>
<?php
}
}
echo "<style>
.i1{
background-color:gray;
}
</style>";
?>
Before Output:
<head>
</head>
<body>
<table cellpadding="4">
<form method=" post " action="">
<tr><td>regno</td><td><input id=" i1" type="text " placeholder=" Enter your regno " required name=" reg "> </td> </tr>
<tr><td>name</td><td><input id=" i2 " type=" text " placeholder=" Enter your name " required name=" nm "> <br>
<tr> <td> Notfication </td> <td> <textarea id="i3" required name="t1" height="300" width="300"> </textarea> </td> </tr>
</table>
<input type=" submit " value=" send " onclick="return chk();" name="s">
</form>
</body>
</html>
<?php
// include the file
include('con1.php');
// check the submit button is clicked or not
if(isset($_POST['s'])){
$reg=$_POST['reg'];
$nm=$_POST['nm'];
$res=$_POST['t1'];
// insert the data into mysql database
$sql="INSERT INTO `mark` (`regno`,`name`,`result`) VALUES ('$reg','$nm','$res')";
$con->query($sql);
}
?>
<?php include('con1.php'); ?>
<html>
<head>
<style>#i{background-color:red;} #in {
border-top: none;
border-left: none;
border-right: none;
border-bottom: 1px solid;
box-shadow: 1px 1px;
margin-top:0px;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
padding-top: 0px;
padding-left: 0px;
padding-right: 0px;
}#in:focus {
padding: 15px;
transition: padding 0.4s;
} @media only screen and (max-width: 480px) {
.contact-details .detail {
display: block;
}
}
.card-skills {
position: relative;
}
.skill-info {
margin-left: 20px;
}
@media only screen and (min-width: 768px) {
.skill {
border-left: 9px solid #555555;
}
.skill.beginner {
height: 50%;
border-color: #e74c3c;
}
.skill.intermediate {
height: 70%;
border-color: #f1c40f;
}
.skill.advanced {
border-color: #5cb85c;
}
.skill.master {
border-color: black;
}
}
@media (max-width: 768px) {
.quote {
font-size: inherit;
}
}
@media print {
body {
font-size: 10pt;
}
a[href]:after {
content: none !important;
}
.pagebreak {
page-break-before: always;
}
.background-card h4:not(:first-child) {
margin-top: 0 !important;
}
.card {
border: 0;
padding: 0;
}
.container {
max-width: 100%;
width: 100%;
}
.contact-details .detail .icon {
color: #888 !important;
}
</style>
</head>
</html>
<form method=" post " action="">
<?php
$sql=" SELECT count(result) FROM `mark` ";
$res=$con->query($sql);
while( $row= mysqli_fetch_array($res)){
$cnt = $row['count(result)'];
if($cnt<=0){
echo "<button> Notfication( ) </button>";
}else {
?>
<input type=" submit " id= 'i' name= "sub" value= "Notfication (<?php echo $cnt; ?>)"> </button> <br>
<?php
}
}
if(isset($_POST['sub'])){
$qry="select * FROM `mark`";
$re=$con->query($qry);
while($row=mysqli_fetch_array($re)){
?>
<?php echo "<b id='i1'>".$row['result']."</b>.<br>"; ?>
<?php
}
}
echo "<style>
.i1{
background-color:gray;
}
</style>";
?>
Before Output:
Nice article bro very usefull for beginners
ReplyDeleteSuper bro
ReplyDelete