init
This commit is contained in:
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