Wednesday, 28 February 2018

Data Base Connectivity By using PHP

<?php
$con = mysqli_connect("localhost","root","","Assignment");
if (mysqli_connect_error()) // if not connected
{
  echo "Cannot connect to database";
}
else
{
$first=$_POST["fname"];
$last=$_POST["lname"];

$subj=$_POST["subject"];
$gender=$_POST["gender"];

$lang=$_POST["lang"];
$q=mysqli_query($con,"INSERT INTO student(Fname,Lname,Subject,Gender,language) VALUES('$first','$last','$subj','$gender','$lang')");
if(!$q)
{
echo "insertion failed....";
}
else
{
    ?>
     <script>
     var conf = confirm("successfully data inserted....");
   if(conf)
 
 window.location="index.html";
</script>
 <?php
mysqli_close($con);


}
}

?>

Wednesday, 31 January 2018

display in block by using javascript

<html>
<head>
    <style>
    #di
        {
            display:none;
        }
        #d2
        {
            display:none;
        }
    </style>
</head>
<body>
    <div id="di">
        <p>This is my first paragraph</p>
    </div>
    <div id="d2">
        <p>this is 2nd paragraph</p>
    </div>
    <button onMouseMove ="display()">Click Me</button>
    <button onClick="hide()">Click Me again</button>
</body>
<script>
    function display()
    {
        document.getElementById("di").style.display="block";
        document.getElementById("d2").style.display="block";
    }
    function hide()
    {
        document.getElementById("di").style.display="none";
        document.getElementById("d2").style.display="none";
    }
    </script>
</html>

Friday, 19 January 2018

Simple if in javascript



<html>
    <head>
    </head>
    <body>
    <form >
        <label>
            Enter your Number
        </label>
        <input type="text" id="n1"/>
        <button type="button" onClick="getval()">Click me</button>
        <label>
            Answer
        </label>
        <input type="text" id="n3"/>
        </form>
        <br>
       
       
    </body>
</html>
<script>
    function getval()
    {
        var marks=document.getElementById("n1").value;
        if (marks>=33)
            {
                document.getElementById("n3").value="You Pass";
            }
        else
            {
                document.getElementById("n3").value="You fail";
            }
    }
   
           
        </script>

Wednesday, 17 January 2018

Get Element By Id









<html>
    <head>
    </head>
    <body>
    <form >
        <label>
            Enter First Number
        </label>
        <input type="text" id="n1"/>
        <label>
            Enter second number
        </label>
        <input type="text" id="n2"/>
        <br>
        <button type="button" onClick="getval()">Click me</button>
        <label>
            Answer
        </label>
        <input type="text" id="n3"/>
        </form>
        <br>
        <p id="p1">ahmad amjad</p>
       
    </body>
</html>
<script>
    function getval()
    {
        var num1;
        num1 = parseInt(document.getElementById("n1").value);
        var num2= parseInt(document.getElementById("n2").value);
        var sum=num1+num2;
        document.getElementById("n3").value=sum;
        document.getElementById("p1").innerHTML="this is answer";
        confirm("are u sure");
        alert("its ok");
      
    }
   
           
        </script>

Saturday, 23 December 2017

Table, Order list, Un-oder list, heading and paragraph tags









<!doctype html>
<html>
    <head>
       
        <title>My first page</title>
    </head>
    <body>
    <h1>My first page</h1>
    <h2>My first page</h2>
    <h3>My first page</h3>
    <h4>My first page</h4>
    <h5>My first page</h5>
    <h6>My first page</h6>
    <br>
    <p>i like to design website , it is my hobby. </p>
    <br>
    <ul>
        <li>car</li>
        <li>Motorcycle</li>
        <li>Bus</li>
    </ul>
    <br>
    <ol>
        <li>Car</li>
        <li>motorcycle</li>
        <li>Bus</li>
    </ol>
   
        <table border="1">
            <tr>
            <th>Name</th>
            <th>Contact</th>
               
            </tr>
            <tr>
                <td>
                    Ahmad
                </td>
                <td>
                123456789
                </td>
            </tr>
            <tr>
                <td>Adil</td>
                <td>12345678</td>
            </tr>
            <tr>
                <td>
                    Ahmad
                </td>
                <td>
                    12345678
                </td>
            </tr>
            <tr>
                <td>Adil</td>
                <td>12345678</td>
            </tr>
           
        </table>
        <br><br>
        <table border="5">
            <tr>
            <th>Name</th>
            <th>Contact</th>
            <th>Marks</th>
            </tr>
            <tr>
                <td>Ahmad</td>
                <td>12345678</td>
                <td>98</td>
            </tr>
            <tr>
                <td>Ahmad</td>
                <td>12345678</td>
                <td>98</td>
            </tr>
            <tr>
                <td>ali</td>
                <td>43746334</td>
                <td>78</td>
            </tr>
        </table>
       
    </body>
   
</html>

Sunday, 26 November 2017

Inventory System by using HTML, CSS and Javascript








Inventory system by using HTML, CSS and javascript

<html>
<head>
<title>Product Price</title>
<style type="text/css">
#p1
{
    font-family:Times New Roman;
}
#p2
{
    font-family:Times New Roman;
}
#p2
{
    font-family:Times New Roman;
}
#p2
{
    font-family:Times New Roman;
}
#p2
{
    font-family:Times New Roman;
}
#price
{
    font-family:Times New Roman;
}
#table
{
    border:1;
}
#f
{
    background-color:Yellow;
}
#total
{
    background-color:White;
}
</style>
</head>
<body>
<center>
<form name="f"  id="f">
<select name="product">
<option value="-1" >Select Product</option>
<option  value="0" id="p1" onclick="rvalue('p1')">Bread 40</option>
<option  value="1" id="p2" onclick="rvalue('p2')">Egg 12</option>
<option  value="2" id="p3" onclick="rvalue('p3')">Milk Packet 50</option>
<option  value="3" id="p4" onclick="rvalue('p4')">Burgger 60</option>
<option  value="4" id="p5" onclick="rvalue('p5')">Shwarma 40</option>

</select>
<br />
<input type="text" placeholder="Quantity" id="price" />
<button type="button" onclick="sum()">Add</button><br />
</form>
<br />
<table  id="table" border="1">
<tr>
<th>Sr.</th>
<th>Name</th>
<th>unit Price</th>
<th>Quanity</th>
<th>Total Price</th>
</tr>
</table>
<input type="text" id="total" />
<button type="button" onclick= "totall()">Total</button>
</center>

<script type="text/javascript">
    pname = new Array(5);
    pprice = new Array(5);
    pname[0] = "Bread";
    pprice[0] = 40;
    pname[1] = "Eggs";
    pprice[1] = 12;
    pname[2] = "Milk packet";
    pprice[2] = 50;
    pname[3] = "Burgger";
    pprice[3] = 60;
    pname[4] = "Shawarma";
    pprice[4] = 70;
    var index;
    var p=0, total=0, price=0,count=0;
    function rvalue(Pid) {
        index = document.getElementById(Pid).value;
      

    }
    function sum() {
        p = Number(document.getElementById("price").value);
        price = p * pprice[index];
        total += price;
       
        count++;
        var table = document.getElementById("table");
        var row = table.insertRow(-1);
        var cell1 = row.insertCell(0);
        cell1.innerHTML = count;
        var cell2 = row.insertCell(1);
        cell2.innerHTML = pname[index];
        var cell3 = row.insertCell(2);
        cell3.innerHTML = pprice[index];
        var cell4 = row.insertCell(3);
        cell4.innerHTML = p;
        var cell5 = row.insertCell(4);
        cell5.innerHTML = price;
        document.getElementById("f").reset();
        index = 0;
    }
    function totall() {
        document.getElementById("total").value = total;
    }
     
  
</script>


</body>
</html>

Wednesday, 22 November 2017

Use of Colspan and Rownspan in HTML table







Colspan and Rowsapn in HTML Table

<!doctype html />
<html>
<head>


</head>
<body>
<center>
<table border="1">
<tr><td rowspan="3">Day</td>
<td colspan="3">Seminar</td>


</tr>
<tr><td colspan="2">Shedule</td>
<td rowspan="2">Topic</td>


</tr>

<tr><td>Being</td>
<td>End</td>


</tr>
<tr><td rowspan="2">Monday</td>
<td rowspan="2">8:00 am</td>
<td rowspan="2">5:00 am</td>
<td>Intorduction ot XML</td>
</tr>
<tr><td>Validity DDT and RElax</td>

</tr>
<tr><td rowspan="3">Tuesday</td>
<td>8 am</td>
<td>11 am</td>
<td rowspan="2">XP Path</td>
</tr>
<tr><td>11 am</td>
<td>2 pm</td>


</tr>
<tr><td>2 pm</td>

<td>5 pm</td>
<td>Xml Transformation</td>
</tr>
<tr><td>Wednesday</td>
<td>8 am</td>
<td>12 pm</td>
<td>Xml Formatting</td>
</tr>
</table>


</center>
</body>



</html>