session videos link
6:54 PM
https://drive.google.com/file/d/0B5dYMHEhXi9tM05jZ0xteUc4X1E/edit?usp=sharing
print user name using session
6:34 PMprint user name using session
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
Session_Start();
$_SESSION['FName']='wasiq';
$_SESSION['LName']='khan';
echo $_SESSION['FName'];
echo $_SESSION['LName'];
?>
<form action="session2.php" method="post">
Name::<input type="text" name="nametext" value="">
FName::<input type="text" name="fnametext" value="">
<input type="submit" name="go" value="enter" />
</form>
</body>
</html>
any other page
<?php
session_start();
echo $_SESSION['FName'];
$name=$_POST['nametext'];
$fname=$_POST['fnametext'];
echo $name.$fname;
?>
prompt calculater with javascript
2:40 PM
<html>
<head>
<title>Calculator</title>
<script type=text/javascript>
function calculator() {
while (operation != 0) {
var operation = prompt("What would you like to do?\n\n0. end the program\n1. do addition\n2. do subtraction\n3. do multiplication\n4. do division\n5. do square root\n", "Type you selection here");
if (operation == 1) {
var num1 = prompt("Enter the first number");
var num2 = prompt("Enter the second number");
alert ("The sum is " + (Number(num1)+Number(num2)));
} else if (operation == 2) {
var num1 = prompt("Enter the first number");
var num2 = prompt("Enter the second number");
alert ("The difference is " + (Number(num1)-Number(num2)));
} else if (operation == 3) {
var num1 = prompt("Enter the first number");
var num2 = prompt("Enter the second number");
alert ("The product is " + (Number(num1)*Number(num2)));
} else if (operation == 4) {
var num1 = prompt("Enter the first number");
var num2 = prompt("Enter the second number");
alert ("The quotiant is " + (Number(num1)/Number(num2)));
} else if (operation == 5) {
var num1 = prompt("Enter the number");
alert ("The square root is " + Math.sqrt(Number(num1)));
}
}
}
</script>
</head>
<body>
<h2><i>Repetition... Looping</i></h2>
<h1><font color=blue>Simple While Loop</font></h1>
<hr>
<center>
<input type=button value="run this program" onclick="calculator()">
</center>
<hr>
<h3>Description</h3>
<h3>Input</h3>
<h3>Output</h3>
<h3>Termination</h3>
</body>
</html>
http://forums.zybez.net/topic/1122395-creating-a-javascript-calculator-that-uses-prompts/
<head>
<title>Calculator</title>
<script type=text/javascript>
function calculator() {
while (operation != 0) {
var operation = prompt("What would you like to do?\n\n0. end the program\n1. do addition\n2. do subtraction\n3. do multiplication\n4. do division\n5. do square root\n", "Type you selection here");
if (operation == 1) {
var num1 = prompt("Enter the first number");
var num2 = prompt("Enter the second number");
alert ("The sum is " + (Number(num1)+Number(num2)));
} else if (operation == 2) {
var num1 = prompt("Enter the first number");
var num2 = prompt("Enter the second number");
alert ("The difference is " + (Number(num1)-Number(num2)));
} else if (operation == 3) {
var num1 = prompt("Enter the first number");
var num2 = prompt("Enter the second number");
alert ("The product is " + (Number(num1)*Number(num2)));
} else if (operation == 4) {
var num1 = prompt("Enter the first number");
var num2 = prompt("Enter the second number");
alert ("The quotiant is " + (Number(num1)/Number(num2)));
} else if (operation == 5) {
var num1 = prompt("Enter the number");
alert ("The square root is " + Math.sqrt(Number(num1)));
}
}
}
</script>
</head>
<body>
<h2><i>Repetition... Looping</i></h2>
<h1><font color=blue>Simple While Loop</font></h1>
<hr>
<center>
<input type=button value="run this program" onclick="calculator()">
</center>
<hr>
<h3>Description</h3>
<h3>Input</h3>
<h3>Output</h3>
<h3>Termination</h3>
</body>
</html>
http://forums.zybez.net/topic/1122395-creating-a-javascript-calculator-that-uses-prompts/
temperature converter in javascript
2:35 PM
<!--
Tempature Converter
By Kai Yuet (kaiy911@hotmail.com)
For this script and more,
Visit http://javascriptkit.com
-->
<FORM>
Fahrenheit:<INPUT TYPE="text" NAME="F" VALUE="" SIZE="6" MAXLENGTH="6" onChange="eval('C.value = ' + this.form.C_expr.value);eval('K.value = ' + this.form.K_expr.value)">
<INPUT TYPE="hidden" NAME="F_expr" VALUE="(Math.round(((212-32)/100 * C.value + 32)*100))/100;">
<INPUT TYPE="hidden" NAME="F_expr2" VALUE="(Math.round(((212-32)/100 *(K.value - 273) + 32)*100))/100; ">
Celsius:<INPUT TYPE="text" NAME="C" VALUE="" SIZE="6" MAXLENGTH="6" onChange="eval('F.value = ' + this.form.F_expr.value);eval('K.value = ' + this.form.K_expr.value)">
<INPUT TYPE="hidden" NAME="C_expr" VALUE="(Math.round((100/(212-32) * (F.value - 32))*100))/100"> <INPUT TYPE="hidden" NAME="C_expr2" VALUE="(Math.round(K.value - 273))">
Kelvin:<INPUT TYPE="text" NAME="K" VALUE="" SIZE="6" MAXLENGTH="6" onChange="eval('F.value = ' + this.form.F_expr2.value);eval('C.value = ' + this.form.C_expr2.value)">
<INPUT TYPE="hidden" NAME="K_expr" VALUE="(Math.round((100/(212-32) * (F.value - 32))*100))/100 + 273">
<INPUT TYPE="button" NAME="Reset" VALUE="Submit">
<INPUT TYPE="Reset" NAME="Reset" VALUE="Reset">
</FORM>
Tempature Converter
By Kai Yuet (kaiy911@hotmail.com)
For this script and more,
Visit http://javascriptkit.com
-->
<FORM>
Fahrenheit:<INPUT TYPE="text" NAME="F" VALUE="" SIZE="6" MAXLENGTH="6" onChange="eval('C.value = ' + this.form.C_expr.value);eval('K.value = ' + this.form.K_expr.value)">
<INPUT TYPE="hidden" NAME="F_expr" VALUE="(Math.round(((212-32)/100 * C.value + 32)*100))/100;">
<INPUT TYPE="hidden" NAME="F_expr2" VALUE="(Math.round(((212-32)/100 *(K.value - 273) + 32)*100))/100; ">
Celsius:<INPUT TYPE="text" NAME="C" VALUE="" SIZE="6" MAXLENGTH="6" onChange="eval('F.value = ' + this.form.F_expr.value);eval('K.value = ' + this.form.K_expr.value)">
<INPUT TYPE="hidden" NAME="C_expr" VALUE="(Math.round((100/(212-32) * (F.value - 32))*100))/100"> <INPUT TYPE="hidden" NAME="C_expr2" VALUE="(Math.round(K.value - 273))">
Kelvin:<INPUT TYPE="text" NAME="K" VALUE="" SIZE="6" MAXLENGTH="6" onChange="eval('F.value = ' + this.form.F_expr2.value);eval('C.value = ' + this.form.C_expr2.value)">
<INPUT TYPE="hidden" NAME="K_expr" VALUE="(Math.round((100/(212-32) * (F.value - 32))*100))/100 + 273">
<INPUT TYPE="button" NAME="Reset" VALUE="Submit">
<INPUT TYPE="Reset" NAME="Reset" VALUE="Reset">
</FORM>
code for register a student php
1:51 PM
Html Code .............................................................................
<div id="mainheading" align="center">
<form action="signuppage.php" method="post" id="myform" onsubmit="" >
<div id="registernow">
<h2 align="center"><h1>Sign up Here</h1></div>
<table>
<tr>
<td><strong> Firstname  </strong></td>
<td><input type="text" name="firstname" size="20"placeholder="First name" > </td>
</tr>
<br>
<tr>
<td><br/> <strong>Lastname  </strong></td>
<td><br/> <input type="text" name="lastname" size="20" placeholder="Last name"></td>
</tr>
<tr>
<td><br/><strong>Username  </strong></td>
<td> <br/><input type="text" name="username" size="20" placeholder="User name"></td>
</tr>
<tr>
<td> <br/><strong>Password  </strong></td>
<td><br/><input type="password" name="password1" size="20" placeholder="Password"></td >
</tr>
<tr>
<td><br/> <strong>Gender  </strong></td>
<td><br/> <input type="radio" name="group1" value="Male"> Male   
<input type="radio" name="group1" value="Femal"> Female   
<input type="radio" name="group1" value="Other" checked="checked"> Other    </td>
</tr>
<tr>
<td><br/><input type="submit"value= "Sign Up" name="submit"> </td>
<td><br/><input type="reset" value="Reset" name="reseter" > </td>
</tr>
</table>
</form>
php code..............................................................................................................
<?php
if(isset($_POST['submit']))
{
$fname=$_POST['firstname'];
$lname=$_POST['lastname'];
$uname=$_POST['username'];
$password=$_POST['password1'];
$gender=$_POST['group1'];
$link = mysql_connect('localhost', 'root', '');
if (!$link)
{
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('signup_db', $link);
if (!$db_selected)
{
die ('Can\'t use foo : ' . mysql_error());
}
if ((!$fname||!$lname||!$uname||!$password ))
{
echo "<script> alert('Kindly Fillout All Fields')</script>";
}
else
{
$check = mysql_query("SELECT * FROM signup_tb WHERE username='$uname'");
if (mysql_num_rows($check)>=1)
{
echo "<script> alert('Username Already Taken')</script>";
}
else
{
$link = mysql_query("INSERT INTO signup_tb(id, firstname, lastname, username,password1,gender) VALUES ('NULL','$fname','$lname','$uname','$password','$gender')")
or die (mysql_error());
if (!mysql_query($link))
{
echo "<script> alert('Your Account Has Been Created!! ')</script>";
echo "<script> window.open('loginpage.php','_self')</script>";
}
}
}
}
?>
<div id="mainheading" align="center">
<form action="signuppage.php" method="post" id="myform" onsubmit="" >
<div id="registernow">
<h2 align="center"><h1>Sign up Here</h1></div>
<table>
<tr>
<td><strong> Firstname  </strong></td>
<td><input type="text" name="firstname" size="20"placeholder="First name" > </td>
</tr>
<br>
<tr>
<td><br/> <strong>Lastname  </strong></td>
<td><br/> <input type="text" name="lastname" size="20" placeholder="Last name"></td>
</tr>
<tr>
<td><br/><strong>Username  </strong></td>
<td> <br/><input type="text" name="username" size="20" placeholder="User name"></td>
</tr>
<tr>
<td> <br/><strong>Password  </strong></td>
<td><br/><input type="password" name="password1" size="20" placeholder="Password"></td >
</tr>
<tr>
<td><br/> <strong>Gender  </strong></td>
<td><br/> <input type="radio" name="group1" value="Male"> Male   
<input type="radio" name="group1" value="Femal"> Female   
<input type="radio" name="group1" value="Other" checked="checked"> Other    </td>
</tr>
<tr>
<td><br/><input type="submit"value= "Sign Up" name="submit"> </td>
<td><br/><input type="reset" value="Reset" name="reseter" > </td>
</tr>
</table>
</form>
php code..............................................................................................................
<?php
if(isset($_POST['submit']))
{
$fname=$_POST['firstname'];
$lname=$_POST['lastname'];
$uname=$_POST['username'];
$password=$_POST['password1'];
$gender=$_POST['group1'];
$link = mysql_connect('localhost', 'root', '');
if (!$link)
{
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('signup_db', $link);
if (!$db_selected)
{
die ('Can\'t use foo : ' . mysql_error());
}
if ((!$fname||!$lname||!$uname||!$password ))
{
echo "<script> alert('Kindly Fillout All Fields')</script>";
}
else
{
$check = mysql_query("SELECT * FROM signup_tb WHERE username='$uname'");
if (mysql_num_rows($check)>=1)
{
echo "<script> alert('Username Already Taken')</script>";
}
else
{
$link = mysql_query("INSERT INTO signup_tb(id, firstname, lastname, username,password1,gender) VALUES ('NULL','$fname','$lname','$uname','$password','$gender')")
or die (mysql_error());
if (!mysql_query($link))
{
echo "<script> alert('Your Account Has Been Created!! ')</script>";
echo "<script> window.open('loginpage.php','_self')</script>";
}
}
}
}
?>


