Tuesday, October 21, 2025
HomePHPEasy methods to replace the Information in PostgreSQL utilizing PHP

Easy methods to replace the Information in PostgreSQL utilizing PHP


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

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

{

$ename=$_POST[’empname’];

$eemail=$_POST[’empemail’];

$emobile=$_POST[’empmobile’];

$edept=$_POST[’empdept’];

$empid=$_GET[‘id’];

// Execute the question with parameters

$end result = pg_query($conn, “replace tblemployee set empname=”$ename”,empemailid=’$eemail’,empmobileno=’$emobile’,empdepartment=”$edept” the place id=’$empid'”);

 

if ($end result) {

     echo ‘<script>alert(“Worker Particulars up to date efficiently!”)</script>’;

    echo “<script sort=”textual content/javascript”> doc.location = ‘learn.php’; </script>”;

} 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 Updation  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>

<type>

physique {

shade: #999;

background: #f3f3f3;

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

}

.form-control {

border-color: #eee;

min-height: 41px;

box-shadow: none !vital;

}

.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 stable #5cd3b4;

}

.signup-form type {

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;

high: 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 !vital;

}

.signup-form a {

shade: #5cd3b4;

text-decoration: underline;

}

.signup-form a:hover {

text-decoration: none;

}

.signup-form type a {

shade: #5cd3b4;

text-decoration: none;

}

.signup-form type a:hover {

text-decoration: underline;

}

</type>

</head>

<physique>

<div class=“signup-form”>

 

       <div class=“row”>

         <div class=“col-12”>

<h2>Replace Worker Information</h2>

</div>

       </div>

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

<?php

$empid=$_GET[‘id’];

$question= pg_query($conn,“choose * from tblemployee the place id=’$empid'”);

$cnt=1;

whereas($row=pg_fetch_array($question)){

?>

 

 

        <div class=“form-group row”>

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

<div class=“col-8”>

                <enter sort=“textual content” class=“form-control” identify=“empname” worth=<?php echo $row[’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” worth=<?php echo $row[’empemailid’];?> 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” worth=<?php echo $row[’empmobileno’];?> 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” worth=<?php echo $row[’empdepartment’];?> required=“required”>

            </div>        

        </div>

 

         <div class=“form-group row”>

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

<div class=“col-8”>

                <enter sort=“textual content” class=“form-control” identify=“cdate” worth=<?php echo $row[‘creationdate’];?> readonly>

            </div>        

        </div>

    <?php } ?>

<div class=“form-group row”>

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

 

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

</div>  

</div>

</type>

<div class=“form-group row”>

<div class=“col-8”>

    <a href=“learn.php” type=“shade:purple”>View Information</a>

            </div>        

        </div>

 

 

</div>

</physique>

</html>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments