baseline 7.4 as-is produzione

This commit is contained in:
2026-09-09 14:32:53 +00:00
commit 71ec465d7a
3638 changed files with 859299 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
<?php␍
␍
if(isset($_POST['idarticletype']))␍
{␍
$idarticletype = $_POST['idarticletype'];␍
␍
include 'dropdown.php';␍
␍
$obj = new Dropdown();␍
␍
$rows = $obj->fetchCharact($idarticletype);␍
␍
echo json_encode($rows); ␍
}␍
␍
?>
+84
View File
@@ -0,0 +1,84 @@
<?php ␍
␍
Class Dropdown␍
{␍
␍
private $host = 'localhost';␍
private $username = 'u00wiumd4xnrd';␍
private $password = 'ukowysga7w5x';␍
private $dbname = 'dbcov4clvrmrzn';␍
private $connection;␍
␍
//establish connection␍
public function __construct()␍
␍
{␍
␍
try ␍
{␍
$this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname);␍
} ␍
catch (Exception $e) ␍
{␍
echo "Connection error " . $e->getMessage();␍
}␍
}␍
␍
␍
//fetch all country records from database␍
public function fetchCountry()␍
{␍
$data = null;␍
␍
$query = "SELECT * FROM article_type ORDER BY article_type.name_articletype";␍
␍
if ($sql = $this->connection->query($query)) ␍
{␍
while ($rows = mysqli_fetch_assoc($sql)) ␍
{␍
$data[] = $rows;␍
}␍
}␍
␍
return $data;␍
}␍
␍
//fetch model records from database depend upon country id␍
public function fetchModel($idarticletype)␍
{␍
$data = null;␍
␍
$query = "SELECT * FROM modelarticle WHERE idarticletype='".$idarticletype."' ";␍
␍
if ($sql = $this->connection->query($query)) ␍
{␍
while ($rows = mysqli_fetch_assoc($sql)) ␍
{␍
$data[] = $rows;␍
}␍
}␍
␍
return $data;␍
}␍
␍
//fetch Charact records from database depend on article type␍
public function fetchCharact($idarticletype)␍
{␍
$data = null;␍
␍
$query = "SELECT * FROM article_characteristic WHERE idarticletype='".$idarticletype."' ";␍
␍
if ($sql = $this->connection->query($query)) ␍
{␍
while ($rows = mysqli_fetch_assoc($sql)) ␍
{␍
$data[] = $rows;␍
}␍
}␍
␍
return $data;␍
}␍
␍
}␍
␍
?>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+16
View File
@@ -0,0 +1,16 @@
<?php
if(isset($_POST['country_id']))
{
$country_id = $_POST['country_id'];
include 'dropdown.php';
$obj = new Dropdown();
$rows = $obj->fetchCity($country_id);
echo json_encode($rows);
}
?>
+96
View File
@@ -0,0 +1,96 @@
<?php
Class Dropdown
{
private $host = 'localhost';
private $username = 'u00wiumd4xnrd';
private $password = 'ukowysga7w5x';
private $dbname = 'dbcov4clvrmrzn';
private $connection;
//establish connection
public function __construct()
{
try
{
$this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname);
}
catch (Exception $e)
{
echo "Connection error " . $e->getMessage();
}
}
//fetch all country records from database
public function fetchCountry()
{
$data = null;
$query = "SELECT * FROM article_type ORDER BY article_type.name_articletype";
if ($sql = $this->connection->query($query))
{
while ($rows = mysqli_fetch_assoc($sql))
{
$data[] = $rows;
}
}
return $data;
}
//fetch model records from database depend upon country id
public function fetchModel($idarticletype)
{
$data = null;
$query = "SELECT * FROM modelarticle WHERE idarticletype='".$idarticletype."' ";
if ($sql = $this->connection->query($query))
{
while ($rows = mysqli_fetch_assoc($sql))
{
$data[] = $rows;
}
}
return $data;
}
//fetch Charact records from database depend on article type
public function fetchCharact($idarticletype)
{
$data = null;
$idarticletype = (int)$idarticletype;
$query = "
SELECT DISTINCT
ac.*
FROM article_characteristic ac
INNER JOIN standards s
ON s.idarticlecharacteristic = ac.idarticlecharacteristic
AND s.idarticletype = ac.idarticletype
WHERE ac.idarticletype = $idarticletype
AND s.active = 'Y'
ORDER BY ac.name_articlecharacteristic
";
if ($sql = $this->connection->query($query))
{
while ($rows = mysqli_fetch_assoc($sql))
{
$data[] = $rows;
}
}
return $data;
}
}
?>
+84
View File
@@ -0,0 +1,84 @@
<?php
Class Dropdown
{
private $host = 'localhost';
private $username = 'u00wiumd4xnrd';
private $password = 'ukowysga7w5x';
private $dbname = 'dbcov4clvrmrzn';
private $connection;
//establish connection
public function __construct()
{
try
{
$this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname);
}
catch (Exception $e)
{
echo "Connection error " . $e->getMessage();
}
}
//fetch all country records from database
public function fetchCountry()
{
$data = null;
$query = "SELECT * FROM article_type ORDER BY article_type.name_articletype";
if ($sql = $this->connection->query($query))
{
while ($rows = mysqli_fetch_assoc($sql))
{
$data[] = $rows;
}
}
return $data;
}
//fetch model records from database depend upon country id
public function fetchModel($idarticletype)
{
$data = null;
$query = "SELECT * FROM modelarticle WHERE idarticletype='".$idarticletype."' ";
if ($sql = $this->connection->query($query))
{
while ($rows = mysqli_fetch_assoc($sql))
{
$data[] = $rows;
}
}
return $data;
}
//fetch Charact records from database depend on article type
public function fetchCharact($idarticletype)
{
$data = null;
$query = "SELECT * FROM article_characteristic WHERE idarticletype='".$idarticletype."' ";
if ($sql = $this->connection->query($query))
{
while ($rows = mysqli_fetch_assoc($sql))
{
$data[] = $rows;
}
}
return $data;
}
}
?>
+137
View File
@@ -0,0 +1,137 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
<!-- Bootstrap Bundle with Popper -->
<script src="bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- jQuery library -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<title>Dynamic Dependent Select Box PHP OOP Ajax : Onlyxcodes</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #3f51b5;">
<div class="container-fluid">
<a class="navbar-brand" href="https://www.onlyxcodes.com/">Onlyxcodes</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="https://www.onlyxcodes.com/2021/07/dynamic-dependent-select-box-php-oop-ajax.html">Back to Tutorial</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12 mt-5">
<?php
include 'dropdown.php';
$obj = new Dropdown();
$rows = $obj->fetchCountry();
?>
<label class="form-label" style="font-size:20px; font-style:bold;">Select Article Type</label>
<select id="articletype_change" class="form-select form-select-lg mb-3" aria-label=".form-select-lg example">
<option>-- select Article Type --</option>
<?php
if(!empty($rows))
{
foreach($rows as $row)
{
?>
<option value="<?php echo $row['idarticletype']; ?>"><?php echo $row['name_articletype']; ?></option>
<?php
}
}
?>
</select>
<label class="form-label" style="font-size:20px; font-style:bold;">Select Model</label>
<select id="model_change" class="form-select form-select-lg mb-3" aria-label=".form-select-lg example">
<option>-- select Model --</option>
</select>
<label class="form-label" style="font-size:20px; font-style:bold;">Select Characteristic</label>
<select id="charact_result" class="form-select form-select-lg mb-3" aria-label=".form-select-lg example">
<option>-- select Characteristic --</option>
</select>
</div>
</div>
</div>
</body>
</html>
<script>
// country dependent ajax
$(document).on("change","#articletype_change", function(e){
e.preventDefault();
var articletype = $("#articletype_change").val();
$.ajax({
type: "POST",
url: "modelart.php",
dataType: "json",
data: "idarticletype="+articletype,
success: function(response)
{
var modelBody = "";
modelBody = "<option>-- select Model --</option>"
for(var key in response)
{
modelBody += "<option value="+ response[key]['idmodelarticle'] +">"+ response[key]['namemodelarticle'] +"</option>";
$("#model_change").html(modelBody);
}
}
});
});
// state dependent ajax
$(document).on("change","#articletype_change", function(e){
e.preventDefault();
var charact = $("#articletype_change").val();
$.ajax({
type: "POST",
url: "articlecharact.php",
dataType: "json",
data: "idarticletype="+charact,
success: function(response)
{
var charactBody = "";
charactBody = "<option>-- select Characteristic --</option>"
for(var key in response)
{
charactBody += "<option value="+ response[key]['idarticlecharacteristic'] +">"+ response[key]['name_articlecharacteristic'] +"</option>";
$("#charact_result").html(charactBody);
}
}
});
});
</script>
+16
View File
@@ -0,0 +1,16 @@
<?php
if(isset($_POST['idarticletype']))
{
$idarticletype = $_POST['idarticletype'];
include 'dropdown.php';
$obj = new Dropdown();
$rows = $obj->fetchModel($idarticletype);
echo json_encode($rows);
}
?>
+16
View File
@@ -0,0 +1,16 @@
<?php
if(isset($_POST['country_id']))
{
$country_id = $_POST['country_id'];
include 'dropdown.php';
$obj = new Dropdown();
$rows = $obj->fetchState($country_id);
echo json_encode($rows);
}
?>