Basic Shortcut Keys needed for PSD to HTML converstion

Before start PSD to HTML converstion

  • Right Click  on filename.psd (file) >> click properties >> Attribute >> tick on Read-Only
ctrl + H => ruler appears on screen
F6         => colors
F7         => For Layers
F8         => Info (Width and Height in pixcel) and other details appears
F12       => Refresh

  • If the image is locked, right click on layer and select conver to smart object
ctrl + C => copy
ctrl + N => new file
ctrl + Shift + Alt + S => To save the Layer
ctrl + Alt + Z => Undo
ctrl + 1 => Normal View
ctrl + 0 => Fits on Screen
  •  Merge two Layers
Make a new layer above layer
Select New + two layers (which has to be Merge)
Right Click and click on Merge Layers



  • For image of exact size

Select the m tool make a layout around the image.
ctrl + Shift + C and Ctrl + N then Ctrl + V


search records of user on basis of id and name

search records of user on basis of id and name (but it fetch records of user of admin who is currently login)

<?php
    error_reporting(E_ALL);
                        include ("menu.php");
                        ?>
                        <form name="searchform" class="search" method="post" action="search.php">
                            <label>Search Records</label>
                            <select id="search" name="search">
                                <option value="id">Id</option>
                                <option value="name">Name</option>
                            </select>

                            <input type="text" name="searchfield" id="searchfield">
                            <input type="submit" value="Go" name ="go"/>
                            <img id="loader" src="./img/loading.gif" style="display:none;"/>
                        </form><br/><br/>
                        <?php
                        if (isset($_REQUEST['go'])) {
                            $search = $_REQUEST['search'];
                            $searchfield = $_REQUEST['searchfield'];
                            $admin_id = $_SESSION['s_admin_id'];
//    echo $search;
                            if ($search == 'id') {
                                ?>
                                <table border="1">
                                    <tr>
                                        <th>ID</th>
                                        <th>Name</th>
                                        <th>Email</th>
                                        <th>Mobile</th>
                                        <th>Country</th>
                                        <th>State</th>
                                        <th>Education</th>
                                        <th>Details</th>
                                        <th>Hobbies</th>
                                        <th>File Name</th>
                                    </tr>  
                                    <?php
                                    $data = mysqli_query($con, "select * from sign_up where a_id= '$admin_id' and id ='$searchfield'"); //fectch all records of user who is currently in login  and id of record
                                    while ($res = mysqli_fetch_array($data)) {
                                        ?>

                                        <tr>
                                            <td><?php echo $res['id']; ?></td>
                                            <td><?php echo $res['name']; ?></td>
                                            <td><?php echo $res['email']; ?></td>
                                            <td><?php echo $res['mobile']; ?></td>
                                            <td><?php echo $res['country']; ?></td>
                                            <td><?php echo $res['state']; ?></td>
                                            <td><?php echo $res['edu_category']; ?></td>
                                            <td><?php echo $res['other_detail']; ?></td>
                                            <td><?php echo $res['hobbies']; ?></td>
                                            <td> <a href = "<?php echo $res['doc_path']; ?>" download target="_blank"> <?= $res['original_doc']; ?></a></td>
                                        </tr>   
                                        <?php
                                    }
                                    ?>
                                </table> 
                                <?php
                            } else {
                                ?>
                                <table border="1">
                                    <tr>
                                        <th>ID</th>
                                        <th>Name</th>
                                        <th>Email</th>
                                        <th>Mobile</th>
                                        <th>Country</th>
                                        <th>State</th>
                                        <th>Education</th>
                                        <th>Details</th>
                                        <th>Hobbies</th>
                                        <th>File Name</th>
                                    </tr> 
                                    <?php
                                    $data = mysqli_query($con, "select * from sign_up where a_id= '$admin_id' and name ='$searchfield'"); //fectch all records of user who is currently in login  and name match of record
                                    while ($res = mysqli_fetch_array($data)) {
                                        ?>

                                        <tr>
                                            <td><?php echo $res['id']; ?></td>
                                            <td><?php echo $res['name']; ?></td>
                                            <td><?php echo $res['email']; ?></td>
                                            <td><?php echo $res['mobile']; ?></td>
                                            <td><?php echo $res['country']; ?></td>
                                            <td><?php echo $res['state']; ?></td>
                                            <td><?php echo $res['edu_category']; ?></td>
                                            <td><?php echo $res['other_detail']; ?></td>
                                            <td><?php echo $res['hobbies']; ?></td>
                                            <td> <a href = "<?php echo $res['doc_path']; ?>" download target="_blank"> <?= $res['original_doc']; ?></a></td>
                                        </tr>   
            <?php
        }
        ?>
                                </table><?php
                                }
                            }
                            ?>

logout code (unset session variable)

contains user profile menu (home, contact form, get details, search, update account and logout) and unset session value and destroy session.

<?php
error_reporting(E_ALL);
include("config.php");
session_start();
if(isset($_REQUEST['log'])){
$log = $_REQUEST['log'];
//==============logout code
if ($log == "logout") {
    unset($_SESSION['s_admin_id']);//unset session value
    unset($_SESSION['s_username']);//unset session value
    session_destroy();  //destroy session
    header("location: login.php");
}}
$admin_id = $_SESSION['s_admin_id'];
$username = $_SESSION['s_username'];
if ($admin_id == "") {  //if sesseion admin id NULL redirect to login.php
    header("location: login.php");
}
$data = mysqli_query($con, "SELECT * FROM admin WHERE admin_id = '$admin_id'");//fetching all record from session admin id
$res = mysqli_fetch_array($data);
$name = $res['a_name'];
$email= $res['a_email'];
$name = strtoupper($name);
?>  
<p>Welcome: <?php echo $name; ?></p> <!--display name of current admin login-->
<div class="menu">
    <ul>
        <?php echo'<li><a href="user.php?type='.$admin_id.'&username='.$username.'">Home</a>|</li>'?>
        <?php echo'<li><a href="form.php?type='.$admin_id.'&username='.$username.'">Contact Form</a>|</li>'?>
        <?php echo'<li><a href="showdetails.php?type='.$admin_id.'&username='.$username.'">Get Details</a>|</li>'?>
        <?php echo'<li><a href="search.php?type='.$admin_id.'&username='.$username.'">Search</a>|</li>'?>
        <?php echo'<li><a href="update.php?type='.$admin_id.'&username='.$username.'">Update Account</a>|</li>'?>
        <?php echo'<li><a href="user.php?log=logout">LogOut</a></li>'?>
    </ul>
</div> 

Fill form (textbox, check box, radio buttom, dropdown) sending email to admin

in this form admin fills detail of user (name, email, mobile no., country, state, education category, other details, hobbies) and email is send to admin and user.

 <?php
include ("menu.php");
                    error_reporting(E_ALL);
                    include("config.php");
//==================================detail filled in form==============================
                    if (isset($_REQUEST['submit'])) {
                        $name = $_REQUEST['name'];
                        $email = $_REQUEST['email'];
                        $mobile = $_REQUEST['mobile'];
                        $country = $_REQUEST['country'];
                        $state = $_REQUEST['state'];
                        $edu_category = $_REQUEST['edu_category'];
                        $other_detail = $_REQUEST['other_detail'];
                        $hobbies = implode(',', $_REQUEST['hobbies']);
                        $admin_id = $_SESSION['s_admin_id'];
                        $original_doc = basename($_FILES["file"]["name"]);
                        $target_path = "../p_project/uploads/";
                        $target_path = $target_path . basename($_FILES["file"]["name"]);

//====================details filled in form will be shown after submit==================
                        echo "<h3>Thank you, your form is submitted successfully.</h3> <br/>";
                        echo 'Your name is <b>' . $name . '</b> <br/><br/>';
                        echo 'Your email is <b>' . $email . '</b> <br/><br/>';
                        echo 'Your number is <b>' . $mobile . '</b><br/><br/>';
                        echo 'Your country is <b>' . $country . '</b><br/><br/>';
                        echo 'Your state is <b>' . $state . '</b><br/><br/>';
                        echo 'Your education is <b>' . $edu_category . '</b><br/><br/>';
                        echo 'Your education is <b>' . $other_detail . '</b><br/><br/>';
                        echo 'Your hobby is <b>' . $hobbies . '</b><br/><br/>';
                        echo 'Your file name is <b>' . $original_doc . '</b><br/><br/>';
                        echo 'Your file path is <b>' . $target_path . '</b><br/><br/>';
                     
                        $sql = "insert into sign_up (id, name, email, mobile, country, state, edu_category, other_detail, hobbies, original_doc, doc_path, a_id) VALUES('', '$name', '$email', '$mobile', '$country', '$state', '$edu_category', '$other_detail', '$hobbies', '$original_doc','$target_path', '$admin_id')";
                        move_uploaded_file($_FILES["file"]['tmp_name'], "uploads/" . $_FILES['file']['name']);    //to upload file on our $target_path = "../p_project/uploads/"

                        mysqli_query($con, $sql) or die(mysql_error());
       
                        

//============================mail sent to admin with filled details ==============
 $admin_id = $_SESSION['s_admin_id'];
$data = mysqli_query($con, "select * from admin where admin_id= '$admin_id'");
$res = mysqli_fetch_array($data);
if (isset($res['a_email'])){
$a_email= $res['a_email'];
date_default_timezone_set('Asia/Calcutta');
$date = date("j F, Y, g:i a");
$to = $a_email;
$email_subject = 'Sign Up form';
$message_body .= "Name: ".$name."\n"; 
$message_body .= "Email : ".$email."\n";
$message_body .= "Mobile : ".$mobile."\n";
$message_body .= "Country : ".$country."\n";
$message_body .= "state : ".$state."\n";
$message_body .= "Education Category : ".$edu_category."\n";
$message_body .= "Other Details : ".$other_detail."\n";
$message_body .= "Hobbies : ".$hobbies."\n";
$message_body .=  "The form has been submitted on". $date;
mail($to, $email_subject, $message_body )or die("failed");

//============================mail sent to user with filled details ================================
date_default_timezone_set('Asia/Calcutta');
$date = date("j F, Y, g:i a");
$to = $_REQUEST["email"]; 
$email_subject = 'Your is succesfully submitted on '.$date; 
$message_body .= "<br/>Thank you for filling our form\n";
$message_body .= "Name: ".$name."\n"; 
$message_body .= "Email : ".$email."\n";
$message_body .= "Mobile : ".$mobile."\n";
$message_body .= "Country : ".$country."\n";
$message_body .= "state : ".$state."\n";
$message_body .= "Education Category : ".$edu_category."\n";
$message_body .= "Other Details : ".$other_detail."\n";
$message_body .= "Hobbies : ".$hobbies."\n";
$message_body .=  "The form has been submitted on". $date;
mail($to, $email_subject, $message_body)or die("Failed");

}

                    } else {
                        ?>
                        <div class="contact_frm">
                            <h3>Contact Form</h3>
                            <form name="user_form" id="user_form" class="user_form" method="post" action="form.php" enctype="multipart/form-data" onsubmit=" return validateform()">
                                <!-- Name -->
                                <table>
                                    <tr>
                                    
                                        <td><label>Name:</label></td>
                                        <td><input type="text" id="user_form_name" name="name"/></td>
                                        <td> <span class="span1"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>Email:</label></td>
                                        <td> <input type="email" id="user_form_email" name="email"/></td>
                                        <td><span class="span2"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>Mobile:</label></td>
                                        <td><input type="text" id="user_form_mobile" name="mobile"/></td>
                                        <td><span class="span3"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>Country:</label></td>
                                        <td><select id="country" name="country"></select></td>
                                        <td><span class="span4"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>State: </label></td>
                                        <td><select class="stateDropDown" name="state" id="state"></select></td>
                                        <td><span class="span5"></span></td>
                                    </tr>
                                     <tr>
                                         <td><div id="edu" class= "education">Education</div></td>
                                        <td><input type="radio" name="edu_category" id="edu_category" value="postgraduate" />Post Graduate
                                    <input type="radio" name="edu_category" id="edu_category" value="graduate" />Graduate</td>
                                        <td><span class="span6"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>Other Details</label></td>
                                        <td><div id="selectList">
                                    <label></label>

                                </div></td>
                                        <td></td>
                                    </tr>
                                     <tr>
                                        <td><label>Select Your Hobbies</label></td>
                                        <td><input type="checkbox" name="hobbies[]" id="cricket" value="cricket">Cricket
                                    <input type="checkbox" name="hobbies[]" id="football" value="football">Football
                                    <input type="checkbox" name="hobbies[]" id="Hockey" value="Hockey">Hockey</td>
                                        <td> <span class="span7"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label for="file">Upload New File:</label></td>
                                        <td><input type="file" name="file" id="file"></td>
                                        <td><span class="span8"></span></td>
                                    </tr>
                                     <tr>
                                        <td><img id="loader" src="./img/loading.gif" style="display:none;"/></td>
                                        <td><input type="submit" value="Submit" name ="submit" /></td>
                                        <td></td>
                                    </tr>
                                </table>

                            </form>

if admin forget password, verification mail(sending activation link)

if admin forget password, In this form admin enter his email id and verification mail is send and as the admin click on link redirects to change password form.

Step 1 forgetform.php
<?php
                    error_reporting(E_ALL);
                    include("config.php");
                    if (isset($_REQUEST['login_btn'])) {
                        //============email entered in form ============================
                        $email = $_REQUEST['email'];
                        $base_url = "http://website.org/prashant_1/p_project/welcome_.php?"; //landing page url for verification link
                        $activation = md5($email . time()); // encrypted email+timestamp
                        //=========================email with Account activation link
                        $message_body = "";
                        $to = $email;
                        $email_subject = 'Change Password';
                        $message_body .= "Hi,  Click on the following link. "."\n";
                        $message_body .= "".$base_url . "activation=" . $activation."\n";   //landing page url with verification link
                        mail($to, $email_subject, $message_body) or die("Failed");
                        mysqli_query($con, "UPDATE admin SET activation='$activation', status='0' WHERE a_email='$email'"); //update Query to deactivated account by update status by ZERO
                        echo '<h1>Thank you Plase... Check your email account for verification link</h1>';
                                               
                       
                    } else {
                        ?>
                        <form name="emailform" class="emailform" method="POST" action="forgetform.php" onsubmit="return forget_email_check()">
                            <h2>Forget Password Page</h2>
                            <table>
                                <tr>
                                    <td><label>Enter Your Email</label></td>
                                    <td><input type="text" name="email" id="email" onchange="forget_email_check();
                        return false;"></td>
                                    <td><span id="span1"></span></td>
                                </tr>
                                <tr>
                                    <td><img id="loader" src="./img/loading.gif" style="display:none;"/></td>
                                    <td><input type="submit" value="Submit" class="login_btn" name="login_btn"></td>
                                    <td></td>
                                </tr>
                            </table>
                        </form>

Step 2 welcome_.php
 <?php
                    error_reporting(E_ALL);
                    include("config.php");
                    $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; //to copy the current url which contains activation code
//                    echo $url;
                    $activation_code = substr($url, -32); //cut last 32 character(activation code) from current url
                    $data = mysqli_query($con, "SELECT * FROM admin WHERE activation ='$activation_code'"); //fetch all details which contain $activation_code in admin table
                    $res = mysqli_fetch_array($data);
                    if ($res['activation'] == $activation_code) {               //if match the $activation_code redirect to newpassform.php which is to change password else error
                        mysqli_query($con, "UPDATE admin SET status='1' WHERE activation='$activation_code'"); //update status to 1 which means account is activated
                        header("location:newpassform.php");      

                    } else {
                        echo "<h1>Try again : please enter a valid email address for activation</h1>";
                    }
                    ?>

how to fetch the record from database for edit and admin as the admin make changes to the form is updated to this record

<?php
include ("menu.php");
                    error_reporting(0);
                    include("config.php");
                    if (isset($_REQUEST['record_id'])){}
                    $record_id=$_REQUEST['record_id'];
                    echo $record_id;
//==================<!--fetching old record from db-->======================================================
                    $data = mysqli_query($con, "SELECT * FROM sign_up WHERE id = '$record_id'");
                    $res = mysqli_fetch_array($data);
                    $name = $res['name'];
                    $email = $res['email'];
                    $mobile = $res['mobile'];
                    $country = $res['country'];
                    $state = $res['state'];
                    $edu_category = $res['edu_category'];
                    $other_detail = $res['other_detail'];
                    $hobbies =  $res['hobbies'];
                    $hob = (explode(',',$hobbies,3));
                    $arrlength = count($hob);
                       
                    $original_doc = $res['original_doc'];
                    $target_path = $res['doc_path'];
//==============================================details filled in form ======================================
                       if(isset($_REQUEST['submit'])){
                $e_name = $_REQUEST['name'];
                $e_mobile = $_REQUEST['mobile'];
                $e_country = $_REQUEST['country'];
                $e_state = $_REQUEST['state'];
                $e_edu_category = $_REQUEST['edu_category'];
                $e_other_detail = $_REQUEST['other_detail'];
                $e_hobbies = implode(',', $_REQUEST['hobbies']);
                $e_original_doc = basename($_FILES["file"]["name"]);
                $e_target_path = "../p_project/uploads/";
                $e_target_path = $e_target_path . basename($_FILES["file"]["name"]);
// ===========================update Query  to update on sign up form=========================================                                                                                    
                $sql = "UPDATE sign_up SET name = '$e_name', mobile = '$e_mobile', country = '$e_country', state = '$e_state', edu_category = '$e_edu_category', other_detail = '$e_other_detail', hobbies = '$e_hobbies', original_doc = '$e_original_doc', doc_path = '$e_target_path' WHERE id = '$record_id';";
//              $sql = "UPDATE sign_up SET name = '$e_name', mobile = '$e_mobile', country = '$e_country', state = '$e_state', edu_category = '$e_edu_category', other_detail = '$e_other_detail', hobbies = '$e_hobbies', original_doc = '$e_original_doc', doc_path = '$e_target_path' WHERE id = '$record_id';";            
                move_uploaded_file($_FILES["file"]['tmp_name'], "uploads/" . $_FILES['file']['name']);    //to upload file on our $target_path = "../p_project/uploads/"
                mysqli_query($con, $sql) or die(mysql_error());
                header("location:showdetails.php");//after updating detail redirect to showdetails.php
//                $msg = "Update successfully";
//    echo "Update successfully";
               
                        }else {
                           
                       

                   // } else {
                        ?>
                        <div class="contact_frm">
                            <h3> Update Contact Form</h3>
                            <form name="user_form" id="user_form" class="user_form" method="post" action="edit.php" enctype="multipart/form-data" onsubmit=" return validateform()">
                            <table>
                                    <tr>
                                   
                                        <td><label>Name:</label></td>
                                        <td><input type="text" id="user_form_name" name="name"<?php if(isset($name) && !empty($name)){echo "value='".$name."'";} ?>/></td><!--fetching old record from db-->
                                        <td> <span class="span1"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>Email:</label></td>
                                        <td> <input type="email" id="user_form_email" name="email"<?php if(isset($email) && !empty($email)){echo "value='".$email."'". " " . "readonly";} ?>/></td><!--fetching old record from db but readonly-->
                                        <td><span class="span2"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>Mobile:</label></td>
                                        <td><input type="text" id="user_form_mobile" name="mobile"<?php if(isset($mobile) && !empty($mobile)){echo "value='".$mobile."'";} ?>/></td><!--fetching old record from db-->
                                        <td><span class="span3"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>Country:</label></td>
                                        <td><select id="country" name="country"><?php echo '<option value=999>'.$res['country'].'</option>'; ?></select> </td><!--fetching old record from db-->
                                        <td><span class="span4"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>State: </label></td>
                                        <td><select class="stateDropDown" name="state" id="state"><?php echo '<option value='.$res['state'].'>'.$res['state'].'</option>'; ?></select></td><!--fetching old record from db-->
                                        <td><span class="span5"></span></td>
                                    </tr>
                                     <tr>
                                         <td><div id="edu" class= "education">Education</div></td>
                                        <td><input type="radio" name="edu_category" id="edu_category" value="postgraduate" <?php if ($edu_category == 'postgraduate') echo 'checked="checked"'; ?> />Post Graduate<!--fetching old record from db-->
                                    <input type="radio" name="edu_category" id="edu_category" value="graduate"  <?php if ($edu_category == 'graduate') echo 'checked="checked"'; ?>/>Graduate</td><!--fetching old record from db-->
                                        <td><span class="span6"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label>Other Details</label></td>
                                        <td><div id="selectList"><label></label><?php echo '<select><option value='.$other_detail.'>'.$other_detail.'</option></select>'; ?></div></td><!--fetching old record from db-->
                                        <td></td>
                                    </tr>
                                     <tr>
                                        <td><label>Select Your Hobbies</label></td>
                                        <td><input type="checkbox" name="hobbies[]" id="cricket" value="cricket" <?php for ($i = 0; $i < $arrlength; $i++){ if($hob[$i] == 'cricket') echo 'checked="checked"'; } ?>>Cricket <!--fetching old record from db-->
                                    <input type="checkbox" name="hobbies[]" id="football" value="football" <?php for ($i = 0; $i < $arrlength; $i++){ if($hob[$i] == 'football') echo 'checked="checked"'; } ?>>Football<!--fetching old record from db-->
                                    <input type="checkbox" name="hobbies[]" id="Hockey" value="Hockey" <?php for ($i = 0; $i < $arrlength; $i++){ if($hob[$i] == 'Hockey') echo 'checked="checked"'; } ?>>Hockey</td><!--fetching old record from db-->
                                        <td> <span class="span7"></span></td>
                                    </tr>
                                     <tr>
                                        <td><label for="file">Upload New File:</label></td>
                                        <td><input type="file" name="file" id="file"</td>
                                        <td><span class="span8">old uploaded file :<a href = "<?php echo $res['doc_path']; ?>" download > <?= $original_doc; ?> </a></span></td><!--fetching old record from db and can be downloaded from here-->
                                    </tr>
                                     <tr>
                                        <td><img id="loader" src="./img/loading.gif" style="display:none;"/></td>
                                        <td><input type="submit" value="Submit" name ="submit" /></td>
                                        <td><?php //echo $msg;?></td>
                                    </tr>
                                </table>
                            </form>