Posts

Showing posts from 2014

Readonly TextField In HTML

<input type="text" name="text" readonly/>

Count Session value in php

$max=count($_SESSION['cart']);

Update Session Value in Php

 if($_REQUEST['command']=='update') { $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=intval($_REQUEST['product'.$pid]); if($q>0 && $q<=999) { $_SESSION['cart'][$i]['qty']=$q; } else { $msg='Some proudcts not updated!, quantity must be a number between 1 and 999'; } } } <script type="text/javascript"> function update_cart(){ document.frm1.command.value='update'; document.frm1.submit(); } </script> <a class="btn btn-default update" href="javascript:update_cart();">Update</a>

Call Javascript function on href.

<a href="javascript:function();"></a>

Unset Session in Php.

else if($_REQUEST['command']=='clear') { unset($_SESSION['cart']); } <script language="javascript"> function del(pid){ if(confirm('Do you really mean to delete this item')){ document.frm1.pid.value=pid; document.frm1.command.value='delete'; document.frm1.submit(); } } function clear_cart(){ if(confirm('This will empty your shopping cart, continue?')){ document.frm1.command.value='clear'; document.frm1.submit(); } } function update_cart(){ document.frm1.command.value='update'; document.frm1.submit(); } </script> function addtocart($pid,$q,$psize,$color){ if($pid<1 or $q<1) return; if(is_array($_SESSION['cart'])){ if(product_exists($pid)) return; $max=count($_SESSION['cart']); $_SESSION['cart'][$max]['productid']=$pid; $_SESSION['cart'][$max]['qty']=$q;

Wamp Acess Error.

Forbidden You don't have permission to access / on this server. Go to c:/wamp/apps/phpmyadmin3.5.1/ <Directory "c:/wamp/apps/phpmyadmin3.5.1/">     Options Indexes FollowSymLinks MultiViews     AllowOverride all         Order Deny,Allow Deny from all Allow from 127.0.0.1 </Directory> change as it as.

KeyUp Function in Jquery on id.

<script type="text/javascript" src="jquery-1.9.0.min.js"></script> <script type="text/javascript"> $(document).ready(function(e) {    $("#docid").keyup(function (e) { //removes spaces from username $(this).val($(this).val().replace(/\s/g, '')); var username = $(this).val(); //if(username.length < 4){$("#user-result").html('');return;} //if(username.length >= 4){ $("#user-result").html('<img src="ajax-loader.gif" />'); $.post('check_username.php', {'username':username}, function(data) {  $("#user-result").html(data); }); //} }); }); </script> <table> <tr> <td class="text">DocID</td> <td><input type="text" name="docid" class="text1" id="docid"/><span id="user-result"></spa

Set Session through php function.

<?php function addtovedio($name){ if(is_array($_SESSION['video'])){ $max=count($_SESSION['video']); $_SESSION['video'][$max]['name']=$name; echo $_SESSION['video']; } else{ $_SESSION['video']=array(); $_SESSION['video'][0]['name']=$name; } } ?>

Filter product.

<?php include("Database.php"); $sql="select * from department"; $sql2="select * from sub_department"; $sql3="select * from brand"; $sql4="select * from frame_type"; $sql5="select * from lens_type"; ?> <!DOCTYPE HTML> <html> <head> <title>Tulip</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link href="csss/bootstrap.css" rel='stylesheet' type='text/css' /> <script type='text/javascript' src="jss/jquery-1.11.1.min.js"></script> <!-- Custom Theme files --> <link href="csss/style.css" rel='stylesheet' type='text/css' /> <!-- Custom Theme files --> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="application/x-javascript"> addEventListen