Files
crm_php/.hta_slug/admin/edit-business-verticals.php
dev sp ca6af2f5e2 init
2024-04-29 12:55:11 +00:00

43 lines
1.6 KiB
PHP

<?php
require_once('/var/www/html/.hta_config/crm_config.php');
require_once('/var/www/html/.htac_header.php');
require_once('/var/www/html/.htac_nav.php');
if($_SERVER['REQUEST_METHOD']=="POST"){
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("UPDATE business_verticals SET bv = :bv WHERE id = :id");
$stmt->bindParam(':bv', $_POST['bv']);
$stmt->bindParam(':id', $_GET['id']);
$stmt->execute();
echo "Record Updated successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
};
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM business_verticals WHERE id=:id");
$stmt->bindParam(":id", $_GET['id']);
$stmt->execute();
$bvrows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($bvrows as $bvname){ ?>
<div>
<form method="post">
<input type="text" name="bv" id="bv" value="<?php echo $bvname['bv']; ?>" />
<input type="submit" value="Update" id="submit" name="submit" />
</form>
</div>
<?php
}
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
}
?>