Wednesday, December 21, 2016

How to change one selected option text to another select option text using jQuery

How to change one selected option text to another select option text using jQuery.

Firstly you need to get option text which you want to put on second selection select option text.


<script>
$(document).ready(function(){

   $("input.manual").on("click",function(){

   var dob_day = $("li.pms-field.register-dob select.day option:selected" ).text();
 var dob_month = $("li.pms-field.register-dob select.month option:selected" ).text();
 var dob_year = $("li.pms-field.register-dob select.year option:selected" ).text();

 $("li.pms-field.popup-dob select.day option:selected" ).text(dob_day);
 $("li.pms-field.popup-dob select.month option:selected" ).text(dob_month);
 $("li.pms-field.popup-dob select.year option:selected" ).text(dob_year);


        });
});
</script>


Tuesday, December 20, 2016

What is the default time of session in php

Php default session time  24 minutes (1440 seconds). Its depends on server configuration.

You can change it in your php-configuration on your webserver. you just need to find on php.ini file session.gc_maxlifetime=1440 you can change the php session default time.



How to show category and subcategory in core php

Learn how to show category and subcategory in core php with mysql.

Firstly you need to crate tow table one for category and second for subcategory.







<?php

mysql_connect('localhost','root','password')or die('could not connect');
mysql_select_db('category_subcategory')or die('could not select db');

$sql="select * from category";
$query = mysql_query($sql);
echo"<ul>";
while($row = mysql_fetch_assoc($query))
{

$id =$row['id'];
echo"<li>".$row['category'];
$sql1="select * from subcategory where category_id='$id'";
$query1 = mysql_query($sql1);
echo"<ul>";
while($row1 = mysql_fetch_assoc($query1))
{
 echo '<li>'.$row1['subcategory'].'</li>';
}
echo'</ul>';
echo '</li>';
}
echo'</ul>';

?>

Your output would be like this