Posts

Showing posts from January, 2019

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