init
This commit is contained in:
52
.hta_slug/forms/_home.php
Normal file
52
.hta_slug/forms/_home.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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');
|
||||
?>
|
||||
<div>
|
||||
<a style="float: right; padding: 10px;" href="/forms/add-forms">Add Forms</a>
|
||||
</div>
|
||||
<?php
|
||||
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");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<div id="grid"></div>
|
||||
<script>
|
||||
const grid = new gridjs.Grid({
|
||||
columns: ["ID", "formname", "bverticals"
|
||||
// { name: "ID", formatter: (cell) => {return gridjs.html(`<a href="/bv/edit-bv/?id=${cell}">Edit</a>`);}}, "Time"
|
||||
],
|
||||
pagination: {limit: 10},
|
||||
search: true,
|
||||
sort: true,
|
||||
resizable: true,
|
||||
data: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve(<?php echo json_encode($rows); ?>);
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
loading: true
|
||||
});
|
||||
grid.render(document.getElementById("grid"));
|
||||
</script>
|
||||
<?php
|
||||
// if (count($rows) >= 1) {
|
||||
// foreach($rows as $row){
|
||||
// echo ' <div style="display: flex; flex-direction: row;">
|
||||
// <a href="/cleads/by-business-verticals/?bv='.$row['bv'].'">'.$row['bv'].'</a>
|
||||
// </div>';
|
||||
// }
|
||||
// } else {
|
||||
// echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
// }
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
51
.hta_slug/forms/add-forms.php
Normal file
51
.hta_slug/forms/add-forms.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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("INSERT INTO addforms (formname, bverticals) VALUES (:formname, :bverticals)");
|
||||
$stmt->bindParam(':formname', $_POST['formname']);
|
||||
$stmt->bindParam(':bverticals', $_POST['bverticals']);
|
||||
$stmt->execute();
|
||||
echo "New Form added successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div style="max-width: 500px;">
|
||||
<form method="post">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<label for="formname">Form Name:</label>
|
||||
<input type="text" name="formname" id="formname" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="bverticals">Select Business Verticals:</label><br>
|
||||
<select name="bverticals" id="bverticals">
|
||||
<option value="0">-Select-</option>
|
||||
<?php
|
||||
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();
|
||||
$bvrows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($bvrows as $bvdata){?>
|
||||
<option value="<?php echo $bvdata['bv']; ?>"><?php echo $bvdata['bv']; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" name="submit" id="submit" value="Save" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user