Posts

How To Edit Data on Edit.php Page With The Help of GET () Method

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

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

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' ]; } ?>

How To Create Your Own Search Engine On Your Website.

1 Create a search form on your website. 2 connect to your database with config.php file 3 create new page searh.php for show search results. //                                     code for search form                                           // <?php ?> <form action="serch.php" method="GET">  <input type="text" name="query" placeholder="search Your Room According To Your Prefered location like sardarpura, basni.." />       <input type="submit" value="search" />       </form> //                                       Code for show search results on search.php page          // <...

PHP interview questions and answers for PHP developers

What is PHP? PHP is a server side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites.Even a non technical person can cretae sites using its CMS.WordPress,osCommerce are the famus CMS of php.It is also an object oriented programming language like java,C-sharp etc.It is very eazy for learning What is the use of "echo" in php? It is used to print a data in the webpage, Example: <?php echo 'Car insurance'; ?> , The following code print the text in the webpage How to include a file to a php page? We can include a file using "include() " or "require()" function with file path as its parameter. What's the difference between include and require? If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue. require_once(), require(), include(...

How to redirect with java script

<?php require('config.php'); SESSION_start(); print_r($_SESSION); if(empty($_SESSION['username']) ) { echo "hello"; echo "<script> window.location = 'http://gm.roomonrentjodhpur.com/admin/login.php';</script>"; } ?>

How to create admin panel login page in php

<?php session_start();  require('config.php'); //3. If the form is submitted or not. //3.1 If the form is submitted if (isset($_POST['username']) and isset($_POST['password'])){ //3.1.1 Assigning posted values to variables. $username = $_POST['username']; $password = $_POST['password']; //3.1.2 Checking the values are existing in the database or not $query = "SELECT * FROM `user` WHERE username='$username' and password='$password'"; $result = mysql_query( $query) ; $count = mysql_num_rows($result); //3.1.2 If the posted values are equal to the database values, then session will be created for the user. if ($count == 1){ $_SESSION['username'] = $username; }else{ //3.1.3 If the login credentials doesn't match, he will be shown with an error message. $fmsg = "Invalid Login Credentials."; } } //3.1.4 if the user is logged in Greets the user with message if (isset($_SESSION[...