Insert record
<form name='forminsert' method='get' action=''>
Employee no
<input name='txtempno' type='text' maxlength=6> <br>
Firstname
<input name='txtfname' type='text'> <br>
Lastname
<input name='txtlname' type='text'> <br>
Department
<input name='txtdept' type='text'> <br>
Extension
<input name='txtphone' type='text'> <br>
<input name='submit' type='submit' value='Save'> <br>
</form>
<?php
//extract all info from the form
$empno=$_GET['txtempno'];
$fname=$_GET['txtfname'];
$lname=$_GET['txtlname'];
$dept=$_GET['txtdept'];
$ext=$_GET['txtphone'];
//develop the SQL command
if($empno!=''){
$sql="insert into employee
(EMPNO, FIRSTNAME, LASTNAME,WORKDEPT, PHONENO)
values
('$empno', '$fname', '$lname', '$dept', '$ext')";
//database connect
$db=mysqli_connect("localhost","root","","mycompanyhr");
// database connection
if ($db==false) {
echo "Connect failed: ". mysqli_connect_error($db);
exit();
}
else {
echo "Connection successful";
}
//execute the SQL command
$rs=mysqli_query($db,$sql);
//check the execution status
if($rs==false){
echo "Record cannot be saved!<br>";
echo "SQL Error : ".mysqli_error($db);
}
else{
echo "<br>Record for $fname saved!<br>";
echo "<a href='listing-table.php'>
List records</a><br>";
}
}//end NULL
?>
Web 2.0 describes the changing trends in the use of World Wide Web technology and web design that aim to enhance creativity , secure information sharing, collaboration and functionality of the web. Web 2.0 concepts have led to the development and evolution of web-based communities and hosted services , such as social-networking sites , video sharing sites , wikis , blogs . Find a website or web application that conform to the criteria of Web 2.0. Put the name of the application and the URL in the comment below. Please provide your full name and matrix number. Make sure the application you choose is not already chosen by your friend in the previous comment.
Comments
Post a Comment