Friday, May 29, 2015

Drop Down Value Fetch through ID and show name






<select class="form-control" name="country_id" value="">
<!--  DDL #######################################################################-->
<?php
include("config.php");
$select=mysql_query("select * from countrylists");
?>
<?php
while($row=mysql_fetch_array($select))

{
?><option value="<?php echo $row["id"]  ?>"><?php echo $row["name"] ?></option>


<?php
}
?>
<!--  DDL #######################################################################-->
</select>

Tuesday, May 26, 2015

CKEDITOR CODE


// ADD CKEDITOR folder also by downloading 

<!DOCTYPE html>
<html>
  <head>





<!-- CKEDITOR Script Start -->

<script src="ckeditor/ckeditor.js"></script>

<link rel="stylesheet" href="sample.css">

<script>



var editor;



// The instanceReady event is fired, when an instance of CKEditor has finished

// its initialization.

CKEDITOR.on( 'instanceReady', function( ev ) {

editor = ev.editor;



// Show this "on" button.

document.getElementById( 'readOnlyOn' ).style.display = '';



// Event fired when the readOnly property changes.

editor.on( 'readOnly', function() {

document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';

document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';

});

});



function toggleReadOnly( isReadOnly ) {

// Change the read-only state of the editor.

// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly

editor.setReadOnly( isReadOnly );

}



</script>

<!-- CKEDITOR Script Closed -->


 
 
 
 
 
    <meta charset="UTF-8">
    <title>Poison Information </title>

    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- Bootstrap 3.3.2 -->

  </head>
  <body class="skin-blue">
 
<?php include("header.php");?>

<div class="content-wrapper">
<?php include("navbar.php");?>
        <!-- Content Header (Page header) -->
        <section class="content-header">

          <h1>
Poison Information
          </h1>

          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Poison Information</a></li>
            <li class="active"> Poison Information Form</li>
          </ol>
        </section>

<!-- Main content -->
        <section class="content">
<div class="row form-group">
            <!-- right column -->
            <div class="col-md-12">
              <!-- general form elements disabled -->
              <div class="box box-warning">
<div class="box-body">




<!-- insert form here -->
<form method="post" action="main_poison_information_heading.php">
<div class="row form-group">
<div class="col-lg-12">
<div class="col-lg-6">
Main Poison Information Heading
</div>

<div class="col-lg-6">
<input type="text" name="main_heading" placeholder="Main Heading"class="form-control" id="exampleInputEmail1">
</div>




</div>

<!-- CKEDITOR TEXTAREA START -->

<div class="col-lg-12">
<div class="col-lg-12">
<textarea name="ckeditor" id="email_content" class="ckeditor" id="email_content" cols="100" rows="10"></textarea>
</div>
</div>

<!-- CKEDITOR TEATAREA Closed -->

<div class="col-lg-12">
<div class="col-lg-12">
<input type="submit"name="sub" value=" Add Poison Information Headings">
<a href="search.php"><input type="button" name="sub" value=" Search Poison"></a>
</div>
</div>
</div>
</form>



             <!-- insert form here -->
  </div><!-- /.box-body -->
              </div><!-- /.box -->
            </div><!--/.col (right) -->
          </div>   <!-- /.row -->
        </section><!-- /.content -->
      </div>
<?php
include("footer.php");
?>

</body>
</html>

View Pop Up on fetch Page in PHP [Consider CSS Part ]





<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>TechNaitra | Dashboard</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- Bootstrap 3.3.2 -->
<!-- Start CSS For Pop Up on View Button -->
<style>
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}

.modalDialog:target {
opacity:1;
pointer-events: auto;
}

.modalDialog > div {

position: relative;
margin: 20px;
padding: 30px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
}

.close {
background: #fff;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
opacity:1 !important;
}

.close:hover { background: #00d9ff; }
</style>

<!-- Close CSS For Pop Up on View Button -->
  </head>
  <body class="skin-blue">
 
<?php

include("sidebar.php");
?>

<div class="content-wrapper">
<!-- Nav bar here -->
<?php include("navbar.php"); ?>
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Student Admission Form
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Forms</a></li>
            <li class="active">Student Admission Form</li>
<li class="active">Show</li>
          </ol>
        </section>






<!-- Main content -->
        <section class="content">
          <div class="row">
            <div class="col-xs-12">



<div class="box">
                <div class="box-header">
                  <h3 class="box-title">Data Table With Full Features</h3>
                </div><!-- /.box-header -->
                <div class="box-body">

<?php
error_reporting(0);

include("config.php");
$select = mysql_query("select * from drug_list");
//echo "$select";
?>
<table class="table table-bordered table-striped">
<tr>

<th>Brand Name</th>
<th>Ingredients</th>
<th>Purpose</th>
<th>Category</th>
<th>Class</th>
<th>State</th>
<th>Colour</th>
<th colspan="3">Operations</th>


</tr>

<?php
while($row=mysql_fetch_array($select))
{
?>
<tr>
<td><?php echo $row['brand_name']."<br>"; ?> </td>
<td><?php echo $row['ingredients']."<br>"; ?> </td>
<td><?php echo $row['purpose']."<br>"; ?> </td>
<td><?php echo $row['category']."<br>"; ?> </td>
<td><?php echo $row['class']."<br>"; ?> </td>
<td><?php echo $row['state']."<br>"; ?> </td>
<td><?php echo $row['colour']."<br>"; ?> </td>


        <td> <a href="edit_drugs_list.php?

brand_name=<?php echo $row['brand_name']?>&
ingredients=<?php echo $row['ingredients']?>&
purpose=<?php echo $row['purpose']?>&
category=<?php echo $row['category']?>&
class=<?php echo $row['class']?>&
state=<?php echo $row['state']?>&
colour=<?php echo $row['colour']?>&
odour=<?php echo $row['odour']?>&
toxic_dose_specified=<?php echo $row['toxic_dose_specified']?>&
lethal_dose_specified=<?php echo $row['lethal_dose_specified']?>&
antidote_specified=<?php echo $row['antidote_specified']?>&
first_aid_measures=<?php echo $row['first_aid_measures']?>&
quantity=<?php echo $row['quantity']?>

">


Edit </a> </td>

<td> <a href="delete_drugs_list.php?drug_list_id=<?php echo $row['drug_list_id']?>">Delete</a> </td>



<td>
<a href="#w<?php echo $row['drug_list_id']?>" >View Details</a>
<div id="w<?php echo $row['drug_list_id']?>" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>

<table border="1"><tr><td>Drug List_Id</td><td><?php echo $row['drug_list_id']?></td></tr>
<tr><td>Brand Nname</td><td><?php echo $row['brand_name']?></td></tr>
<tr><td>Ingredients</td><td><?php echo $row['ingredients']?></td></tr>
<tr><td>Purpose</td><td><?php echo $row['purpose']?></td></tr>
<tr><td>Category</td><td><?php echo $row['category']?></td></tr>
<tr><td>Class</td><td><?php echo $row['class']?></td></tr>
<tr><td>State</td><td><?php echo $row['state']?></td></tr>
<tr><td>Colour</td><td><?php echo $row['colour']?></td></tr>
<tr><td>Odour</td><td><?php echo $row['odour']?></td></tr>
<tr><td>Toxic Dose Specified</td><td><?php echo $row['toxic_dose_specified']?></td></tr>
<tr><td>Lethal Dose Specified</td><td><?php echo $row['lethal_dose_specified']?></td></tr>
<tr><td>antidote Specified</td><td><?php echo $row['antidote_specified']?></td></tr>
<tr><td>First Aid Mmeasures</td><td><?php echo $row['first_aid_measures']?></td></tr>
<tr><td>Quantity</td><td><?php echo $row['quantity']?></td></tr></table>
</div>
</div>

</td>
</tr>

<?php
}
?>



















  </table>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
            </div><!-- /.col -->
          </div><!-- /.row -->
        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->

Thursday, January 1, 2015

JOINS in PHP Language


INNER JOIN

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>example-php-mysql-bit_count()</title>
</head>
<body>
<?php
include("config.php");
?>


<?php
echo "<h2>List of the book ids, name of the book and category description : </h2>";
echo "<table border='1' style='border-collapse: collapse;border-color: silver;'>";
echo "<tr style='font-weight: bold;'>";
echo "
<td width='200' align='center'>Book ID</td>
<td width='200' align='center'>Name of the book</td>
<td width='200' align='center'>Category description</td>
";
echo "</tr>";


$result = mysql_query("SELECT book_mast.book_id,book_mast.book_name,cate_descrip
FROM book_mast
INNER JOIN category
ON book_mast.cate_id=category.cate_id");


while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td align='center' width='200'>" . $row['book_id'] . "</td>";
echo "<td align='center' width='200'>" . $row['book_name'] . "</td>";
echo "<td align='center' width='200'>" . $row['cate_descrip'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>


</body>
</html>

LEFT JOIN in PHP Language


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />  
<title>example-php-mysql-bit_count()</title>  
</head>  
<body>  
<?php
include("config.php");
?>


<?php  
echo "<h2>List of the book ids, name of the book and category description : </h2>";  
echo "<table border='1' style='border-collapse: collapse;border-color: silver;'>";  
echo "<tr style='font-weight: bold;'>";  
echo "
<td width='200' align='center'>Book ID</td>
<td width='200' align='center'>Name of the book</td>
<td width='200' align='center'>Category description</td>
";  
echo "</tr>";  

  
$result = mysql_query("SELECT book_mast.book_id,book_mast.book_name,cate_descrip  
FROM book_mast  
LEFT JOIN category  
ON book_mast.cate_id=category.cate_id");  


while($row=mysql_fetch_array($result))  
{  
echo "<tr>";  
echo "<td align='center' width='200'>" . $row['book_id'] . "</td>";  
echo "<td align='center' width='200'>" . $row['book_name'] . "</td>";  
echo "<td align='center' width='200'>" . $row['cate_descrip'] . "</td>";  
echo "</tr>";  
}  
echo "</table>";  
?>  


</body>  
</html>  


RIGHT JOIN in PHP Language

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />  
<title>example-php-mysql-bit_count()</title>  
</head>  
<body>  
<?php
include("config.php");
?>


<?php  
echo "<h2>List of the book ids, name of the book and category description : </h2>";  
echo "<table border='1' style='border-collapse: collapse;border-color: silver;'>";  
echo "<tr style='font-weight: bold;'>";  
echo "
<td width='200' align='center'>Book ID</td>
<td width='200' align='center'>Name of the book</td>
<td width='200' align='center'>Category description</td>
";  
echo "</tr>";  

  
$result = mysql_query("SELECT book_mast.book_id,book_mast.book_name,cate_descrip  
FROM book_mast  
RIGHT JOIN category  
ON book_mast.cate_id=category.cate_id");  


while($row=mysql_fetch_array($result))  
{  
echo "<tr>";  
echo "<td align='center' width='200'>" . $row['book_id'] . "</td>";  
echo "<td align='center' width='200'>" . $row['book_name'] . "</td>";  
echo "<td align='center' width='200'>" . $row['cate_descrip'] . "</td>";  
echo "</tr>";  
}  
echo "</table>";  
?>  


</body>  
</html>  

Database

database name - dbopen
table name - book_mast ( book_id, book_name, cate_id)
table name - category ( cate_id , cate_descrip)

here, book_id , cate_id are Primary ID's or Auto Increment