How to maintain login and logout session time in php 1 maintain login session time with login page code is below <?php include "config.php"; session_start(); $count=0; if(isset($_POST['submit']) and $_POST['submit'] =="Sign In") { $sql ="select * from user where name ='". $_POST['name']."' and password ='". $_POST['password']."'"; $run = mysql_query($sql); $count=mysql_num_rows($run); if($count > 0) { while($data=mysql_fetch_array($run)) { $id = $data['id']; $type = $data['type']; } $_SESSION['name'] = $_POST['name']; $_SESSION['id'] = $id; echo $_SESSION['type'] = $type; header ("location:index.php"); if($count == 1) { echo $_date = date("y/m/d") ; date_default_timezone_set("Asia/Calcutta"); //India time (GMT+5:30) echo $_time = date...
Posts
- Get link
- X
- Other Apps
How to Add conformation box "Are you sure you want to delete this record?" before delete record from database in your software. 1 Add java script in your application <script type = "text/javascript" > function clicked () { if ( confirm ( 'Do you want to submit?' )) { yourformelement . submit (); } else { return false ; } } </script> Then Add code in your button like below <input type="submit" onclick="return confirm('Are you sure You want to delete this user?')" name="deleteuser" style="background-color:red;color:white; id="deleteuser" value="Delete" placeholder="Movie Name" required="">
How To Show Popup Window on Index Page With The Help Of Java Script
- Get link
- X
- Other Apps
1 Add Following java script in your application in head section just like below. <script type="text/javascript"> function open_on_entrance(url,name) { window.open('http://www.google.com','google', ' menubar,resizable,dependent,status,width=800,height=500,left=300,top=200') } </script> 2 Then Add Code in body tag just like below <body onload="open_on_entrance()"></body>
How to send form data to database with the help of PHP and SQL
- Get link
- X
- Other Apps
<?php include"config.php"; if (isset($_POST ["submit"])) { $sql="insert into book_party(name,email,phone,date, message) values('".$_POST['name']."','".$_POST['email']."','".$_POST['phone']."','".$_POST['date']."' ,'".$_POST['message']."')"; mysql_query($sql); echo $thanks="<font color='blue' size='5'>Thanks For Contactign us, We Will call you Shortly.</font>"; } ?> <form class="" method="post" action="index.php" ><br> <input type="text" name="name" id="name" Placeholder="Name" required /> <br> <input type="text" name="email" id="email" Placeholder="Email" required /><br> ...
How To Edit Data on Edit.php Page With The Help of GET () Method
- Get link
- X
- Other Apps
1 First we receive id on edit.php page from data fetch table page like below. <form action="edit.php?id=<?php echo $id; ?>" method="post" enctype="multipart/form-data"> <input type="image" src="images/icon/icon.png" width="50" id="editm" name="editm" value="<?php echo $data['id'];?>" placeholder="Movie Name" required=""> <input type="hidden" id="idedit" name="idedit" value="<?php echo $data['id'];?>" placeholder="Movie Name" required=""> </form> 2 Then receive data from DB table with help of id like below and then run update query for update data in database like below example. <?php include("config.php"); $id = isset($_GET['id']) ? $_GET['id'] : ''; $query = "SELECT * from school_classmaster...
How To Send id from your DB to different application page from URL
- Get link
- X
- Other Apps
1 First of all fetch data from data base to your software application with the help of select query. <?php $sql = "select * from school_classmaster"; $row=mysql_query($sql); while($data=mysql_fetch_array($row)) $id= $data['id']; ?> 2 In fetch data table provide edit option to edit data <form action="edit.php?id=<?php echo $id; ?>" method="post" enctype="multipart/form-data"> <input type="image" src="images/icon/icon.png" width="50" id="editm" name="editm" value="<?php echo $data['id'];?>" placeholder="Movie Name" required=""> <input type="hidden" id="idedit" name="idedit" value="<?php echo $data['id'];?>" placeholder="Movie Name" required=""> </form>
How To Solve Undefined index error in PHP
- Get link
- X
- Other Apps
Error Notice: Undefined index: productid in /var/www/test/modifyform.php on line 32 Notice: Undefined index: name in /var/www/test/modifyform.php on line 33 Notice: Undefined index: price in /var/www/test/modifyform.php on line 34 Notice: Undefined index: description in /var/www/test/modifyform.php on line 35 Solution Use isset () function to your code just like below <? php if ( isset ( $_POST [ 'name' ])) { $name = $_POST [ 'name' ]; } if ( isset ( $_POST [ 'price' ])) { $price = $_POST [ 'price' ]; } if ( isset ( $_POST [ 'description' ])) { $description = $_POST [ 'description' ]; } ?>