Posts

Showing posts from September, 2016
Imp Facts for development in php 1 allways use id, name in form fields 2 when create submit botton allways gave id and name( same) and veluse(show on botton) 3 form action = (page redirect after submit data), method = post and encrypt type (for any file upload ) 4 if(isset($_POST['addnewmovie']) && !empty($_POST['addnewmovie']=='add new movie')) always $_POST['use form botton id'] && addnewmovie ==' use velue of form botton' 5 When we send id for edit operation send fatch id from db
IMP How to do insert edit and delete on same page 6 When we do insert, fetch, edit on same page do insert and fatch as previous in data fetch table provide collom for edit botton <form action="future_movies.php" method="post" enctype="multipart/form-data"> <input type="submit"  id="editm" name="editm" value="Edit" placeholder="Movie Name" required=""> <input type="hidden"   id="idedit" name="idedit" value="<?php echo $data['id'];?>" placeholder="Movie Name" required=""> </form> Then After Fatch data from DB when we click on edit botton in data fatch table. <?php if(isset($_POST['newedit']) && !empty($_POST['newedit'])) { $sql1="select * from screen where id = '".$_POST['newedit']."'"; $row = mysql_query($sql1); whil...
                       How to add slider in website  1 add the java script in head section <head> <script type="text/javascript"> var wall=0; function slider() { images=new Array(); images[0]='image/promo-students.jpg'; images[1]='image/promo-students.jpg'; images[2]='image/promo-students.jpg'; images[3]='image/4.jpg'; images[4]='image/4.jpg'; images[5]='image/4.jpg'; images[6]='image/7.jpg'; images[7]='image/8.jpg'; images[8]='image/9.jpg'; images[9]='image/1.jpg'; document.getElementById('img_sl').src=images[wall]; if(wall<9) wall++; else wall=0; setTimeout(slider,1000); } </script> </head> and then add this code in <body> section <body onLoad="slider()"> and then put the slider id on location where you want to run slider images. <div class="middle">     <im...
How to create payment integration with paypal on your website. 1 First of all create add to cart process according to client requirements(all calculation/amounts and all that related to client business.) 2 all final amount show on your web application/software. 3 last and final step is payment integration (payment transfer to client bank account from software/web application to client bank account) 1 go to paypal website and create script according to client requirements. I am also provide you a direct link of paypal for create script. https://www.paypal.com/in/cgi-bin/webscr?cmd=_flow&SESSION=tSzjyrSKKCsAbeHxp7RAesZ8QiizNLHBlybNSOtmY-s2DoWY46PWHbdtVZS&dispatch=5885d80a13c0db1f8e263663d3faee8d4fe1dd75ca3bd4f11d72275b28239088 4 after create script its time to install this script on your web application/software you just install this script after all operations done on your web application. 5 then customise the script according to your client requirement and the ...
How To Create Shoping Cart in php 1 create a Db and create a table like movie and fields are id, name, description image, price etc and insert data. 2 Create web page for show your products from db. 3 provide a hiper link on your product image or provide botton the code is           <a href="products.php?id=<?php echo $id; ?> and redirect after clicking on products.php page and also send product id with this code                     ?id=<?php echo $id; 4 then we go to products.php page and we get product id in url just like below. http://localhost/movies/products.php?id=1 we create a table for fetch all details from db like name, price and provide a select box in form and form send to addtocart.php page after click on add to cart botton justlike  below. //                              Code o...
How To Send Website Form Data to Email.  //                                                   Code for send form data                                  // <form name="contactform" method="post" action="send_form_email.php"> <table width="450px"> <tr>  <td valign="top">   <label for="first_name">First Name *</label>  </td>  <td valign="top">   <input  type="text" name="first_name" maxlength="50" size="30">  </td> </tr> <tr>  <td valign="top"">   <label for="last_name">Last Name *</label>  </td>  <td valign="top">   <input  type="text" name="la...
How To fetch data from db and apply pagination to fetch table. (http://www.phpeasystep.com/phptu/29.html)   1 Add The code on your php page //                                              code for applying pagination        //         <?php /* Place code to connect to your DB here. */ //include "connection.php"; // include your code to connect to DB. $tbl_name="adsence"; //your table name // How many adjacent pages should be shown on each side? $adjacents = 3; /*    First get total number of rows in data table.    If you have a WHERE clause in your query, make sure you mirror it here. */ $query = "SELECT COUNT(*) as num FROM $tbl_name"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages['num']; ...
How to change image/file name in your folder and add validation for upload exact file. $file_ext=strtolower(end(explode('.',$_FILES['image']['name']))); $filename=$_POST['name'].'.'.$file_ext; $expensions= array("jpeg","jpg","png"); if(in_array($file_ext,$expensions)=== false){ $errors[]="extension not allowed, please choose a JPEG or PNG file."; } if($file_size > 2097152){ $errors[]='File size must be excately 2 MB';       } if(empty($errors)==true){ copy($_FILES['image']['tmp_name'], 'images/'.$filename ); echo "Success"; }else{ $error1 = $errors['0']; $error2 = $errors['1']; } header ("location:current_movies.php?error=".$error1 ); then print to your page <?php  if(isset($_REQUEST['error']) && !empty($_REQUEST['error'])) { echo $error=$_REQUEST['error'];  } ?> Descrip...
How To UPload Image/Resume/File in php 1 Create a form in html fields names are name, address...etc and file field for upload a file just like code below.   <input type="file"  id="image" name="image" class="form-control"  placeholder="Movie image" required=""> 2 Then create DB field in php myadmin field name=image, type verchar...etc. 3 Then write code in your page     print_r($_FILES); php print all information related to your file on your page Array ( [image] => Array ( [name] => Hydrangeas.jpg [type] => image/jpeg [tmp_name] => C:\xampp\tmp\php7E66.tmp [error] => 0 [size] => 595284 ) ) 4 then write a copy command to copy image from php tmp folder to your website image folder just like below copy($_FILES['image']['tmp_name'], 'images/'.$_FILES['image']['name'] ); Means you copy your image in images folder with image name but i...
How to count total rows from table and fetch data <?php  $i=0; $sqlcm ="select * from movie";  $runcm = mysql_query($sqlcm); while($datacm=mysql_fetch_array($runcm)) {$i++; ?> <label></label> <?php } echo $i; ?>
How To Join 2 Tables of database and fetch data. $sql = "select * from movie join screen on movie.screen=screen.id"; Description :  Select data from movie table and(join) screen table on movie(table) . screen(field) = screen(table) . id(field)  and then fetch data from table. And If field name - (name) same in both join table (movie and screen). then we create join query as below $fatch = "select *, screen.name as sc_name from movie join screen on movie.screen=screen.id"; in above query we save field velue after select * , screen.name as sc_name  means name field of screen table as Sc_name then print sc_name in fetch data table in admin panel.
How to insert data and edit data from same page and create function file 1 Create insert form in php 2 Create table for fatch data from database 3 create table in database name is  movie ----- and table fields are name, length, rating, screen. //      Code  for index page where insert and update operation done       // <body> <?php include"config.php"; $length = ''; $movie = ''; $screen = ''; $rating = ''; //echo $_POST['Submit'] ; if(isset($_POST['editid']) and !empty($_POST['editid'])) { $fde ="select * from movie where id ='".$_POST['editid']."'"; $update1=mysql_query($fde); while($data1= mysql_fetch_array($update1)) { $movie = $data1['name']; $screen = $data1['screen']; $length = $data1['length']; $rating = $data1['rating']; $updateid = $data1['id']; ...
How to redirect the user on login page if session not active 1 add following php code to every admin panel page. //                                                         Code                              // <?php session_start(); if(!isset($_SESSION['id'])) { header("location:signin.php"); } ?>
How To change password from admin panel. 1 Create change password page. 2 create form fields like username, oldpassword, newpassword. //                                             Code                          // <?php include"config.php"; $msg=''; $msg1=''; session_start(); $count=0; if(isset($_POST['submit']) && !empty($_POST['submit'])) {  $sql = "select * from user where email='".$_POST['email']."' and password ='".$_POST['password']."'"; $run = mysql_query($sql); $count = mysql_num_rows($run); if($count>0) { $sql = "UPDATE `user` SET `password`= '".$_POST['newpassword']."'"; $run = mysql_query($sql); $msg1 = "Password change sucessful."; } else { $msg = "Your login details not same."; } } ?> <h3 id="forms-example" class="...
How to approved user from admin panel after registration. 1 After registration admin approved to user from admin apnel. 2 In admin panel we fetch all information related to user in table like id, name, address, email, mobile, password and user status (show link for approved  for non approved user and show disapproved for approved users ). //                                            Code                                                   // <tr>     <td>Name</td>     <td>Email</td>     <td>Address</td>     <td>Mobile Number</td> <td>Password</td> <td>Status</td> <td>delete</td> </tr>...