c1
This commit is contained in:
75
.hta_slug/admin/edit-forms.php
Normal file
75
.hta_slug/admin/edit-forms.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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 addforms SET formname = :formname, bverticals = :bverticals WHERE id = :id");
|
||||
$stmt->bindParam(':formname', $_POST['formname']);
|
||||
$stmt->bindParam(':formname', $_POST['formname']);
|
||||
$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");
|
||||
$stmt->execute();
|
||||
$verticals_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
// foreach($verticals_data as $verticals){
|
||||
// $bverticals = $verticals['bv'];
|
||||
// }
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM addforms WHERE id=:id");
|
||||
$stmt->bindParam(":id", $_GET['id']);
|
||||
$stmt->execute();
|
||||
$formrows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($formrows as $formname){ $pre_verticals = $formname['bverticals']; ?>
|
||||
<div class="flex flex-col place-items-center mt-40 mb-60">
|
||||
<form method="post" class="max-w-2xl shadow-xl p-4 rounded-lg space-y-4" style="width: 100%; max-width: 600px;">
|
||||
<p class="my-4" style="border-bottom: 2px solid #464E5F; border-style: dashed; font-size: 20px; font-weight: bold" >Edit From</p>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="">Form Name:</label>
|
||||
<input type="text" name="formname" id="formname" value="<?php echo $formname['formname']; ?>" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="">Select Business Verticals:</label>
|
||||
<select name="" id="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px; ">
|
||||
<?php
|
||||
foreach($verticals_data as $verticals) {
|
||||
$isSelected = in_array($pre_verticals, $verticals) ? 'selected' : '';
|
||||
echo '<option value="'.$verticals['bv'].'" '.$isSelected.'>'.$verticals['bv'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div class="flex flex-col justify-center">
|
||||
<input type="submit" value="Update" id="submit" name="submit" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 6px; color: #fff; border-radius: 6px; margin-top: 6px;" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user