Sunday, November 30, 2025
HomePHPTips on how to insert knowledge utilizing PostgreSQL and PHP

Tips on how to insert knowledge utilizing PostgreSQL and PHP


<?php include_once(‘dbcon.php’);

if(isset($_POST[‘submit’]))

{

$ename=$_POST[’empname’];

$eemail=$_POST[’empemail’];

$emobile=$_POST[’empmobile’];

$edept=$_POST[’empdept’];

 

// Execute the question with parameters

$consequence = pg_query($conn, “insert into tblemployee(empname,empemailid,empmobileno,empdepartment) values(‘$ename’,’$eemail’,’$emobile’,’$edept’)”);

 

if ($consequence) {

    echo “Information inserted efficiently!”;

} else {

    echo “Error: “ . pg_last_error($conn);

}

// Shut the connection

pg_close($conn);

}

?>

 

<!DOCTYPE html>

<html lang=“en”>

<head>

<meta charset=“utf-8”>

<meta identify=“viewport” content material=“width=device-width, initial-scale=1, shrink-to-fit=no”>

<hyperlink rel=“stylesheet” href=“https://fonts.googleapis.com/css?household=Roboto:400,700”>

<title>Information insertion in PostgreSQL usinh PHP</title>

<hyperlink rel=“stylesheet” href=“https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css”>

<hyperlink rel=“stylesheet” href=“https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css”>

<script src=“https://code.jquery.com/jquery-3.5.1.min.js”></script>

<script src=“https://cdn.jsdelivr.web/npm/popper.js@1.16.0/dist/umd/popper.min.js”></script>

<script src=“https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js”></script>

<fashion>

physique {

shade: #999;

background: #f3f3f3;

font-family: ‘Roboto’, sans-serif;

}

.form-control {

border-color: #eee;

min-height: 41px;

box-shadow: none !essential;

}

.form-control:focus {

border-color: #5cd3b4;

}

.form-control, .btn {        

border-radius: 3px;

}

.signup-form {

width: 500px;

margin: 0 auto;

padding: 30px 0;

}

.signup-form h2 {

shade: #333;

margin: 0 0 30px 0;

show: inline-block;

padding: 0 30px 10px 0;

border-bottom: 3px strong #5cd3b4;

}

.signup-form kind {

shade: #999;

border-radius: 3px;

margin-bottom: 15px;

background: #fff;

box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);

padding: 30px;

}

.signup-form .form-group row {

margin-bottom: 20px;

}

.signup-form label {

font-weight: regular;

font-size: 14px;

line-height: 2;

}

.signup-form enter[type=”checkbox”] {

place: relative;

prime: 1px;

}

.signup-form .btn {        

font-size: 16px;

font-weight: daring;

background: #5cd3b4;

border: none;

margin-top: 20px;

min-width: 140px;

}

.signup-form .btn:hover, .signup-form .btn:focus {

background: #41cba9;

define: none !essential;

}

.signup-form a {

shade: #5cd3b4;

text-decoration: underline;

}

.signup-form a:hover {

text-decoration: none;

}

.signup-form kind a {

shade: #5cd3b4;

text-decoration: none;

}

.signup-form kind a:hover {

text-decoration: underline;

}

</fashion>

</head>

<physique>

<div class=“signup-form”>

    <kind technique=“put up” class=“form-horizontal”>

       <div class=“row”>

         <div class=“col-8 offset-4”>

<h2>Signal Up</h2>

</div>

       </div>

        <div class=“form-group row”>

<label class=“col-form-label col-4”>Title</label>

<div class=“col-8”>

                <enter sort=“textual content” class=“form-control” identify=“empname” required=“required”>

            </div>        

        </div>

<div class=“form-group row”>

<label class=“col-form-label col-4”>Electronic mail</label>

<div class=“col-8”>

                <enter sort=“e-mail” class=“form-control” identify=“empemail” required=“required”>

            </div>        

        </div>

<div class=“form-group row”>

<label class=“col-form-label col-4”>Cell</label>

<div class=“col-8”>

                <enter sort=“textual content” class=“form-control” identify=“empmobile” required=“required”>

            </div>        

        </div>

<div class=“form-group row”>

<label class=“col-form-label col-4”>Division</label>

<div class=“col-8”>

                <enter sort=“textual content” class=“form-control” identify=“empdept” required=“required”>

            </div>        

        </div>

<div class=“form-group row”>

<div class=“col-8 offset-4”>

 

<button sort=“submit” identify=“submit” class=“btn btn-primary btn-lg”>Submit</button>

</div>  

</div>       

    </kind>

</div>

</physique>

</html>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments