AJAX dynamic Dependent Select Box - javascript

What i need?
I need to create an input form that must be fille up with dynamic dropdown list as per below screenshot.
What is my actual script??
Actually is divided in some files, i'll ignore the database connection and the functions file.
assign.php
<?php
session_start();
ob_start();
if(isset($_SESSION['log'])){
include ('connection.php');
include ('functions.php');
//Variables que vienen desde el boton de ASSIGN
$szDescription = $_POST['szDescription'];
$szRequestor = $_POST['szRequestor'];
$szRecived = $_POST['szRecived'];
$szCID = $_POST['szCID'];
?>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no,
initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="..\css\bootstrap.min.css">
<link rel="stylesheet" href="..\css\style.css">
<script type="text/javascript">
// Select Category function
$(document).ready(function(){
$('#szTeam').on('change',function(){
var team_selected = $(this).val();
$.ajax({
type:'POST',
url:'getcategory.php',
data:'teamselected='+team_selected,
success:function(html){
$('#optionCategory').html(html);
}
});
});
});
// FIN TEAM Select
</script>
</head>
<body>
<div class="container-fluid"><div class="container">
<p class="bg-Success">You are about to assign this ticket:</p>
<p><b>Subject:</b><i> <?php echo $szDescription ?></i></p>
<p><b>From:</b><i> <?php echo $szRequestor ?></i></p>
<p><b>Recived:</b><i> <?php echo $szRecived ?></i></p>
<form action="" method="post">
<div class="form-group">
<label for="szTeam">Team</label>
<select class="form-control form-control-sm" name="szTeam" id="szTeam">
<option>Select Team</option>
<?php
foreach($_SESSION['userteam'] as $userteamsArray){
echo "<option>".$userteamsArray."</option>";
}
?>
</select>
</div>
<div class="form-group">
<label for="optionCategory">Category</label>
<select class="form-control form-control-sm" name="optionCategory" id="optionCategory" >
<option></option>
</select>
</div>
<button type="submit" class="btn btn-primary" name="SubmitButton">Submit</button>
</form>
</div></div>
</body>
</html>
getcategory.php
<?php
include ('connection.php');
$team = $_POST['teamselected'];
$query = "SELECT szActivitySubCategory FROM Subcategories WHERE szTeam = '$team'";
$result = sqlsrv_query($conn,$query);
if(!$result){
echo "<center>Error detected:Query <b>".$query."</b> did not work.
<br>Please contact the administrator</center><br>".sqlsrv_errors($query);
}
$ouput = "<option value=\"\">Select Category</option>";
while($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC))
{
$selected = $row['szActivitySubCategory'];
$ouput = $ouput."<option value='$selected'> $selected </option>";
}
echo $ouput;
?>
What is happening??
The code is not working as expected. I tested the getcategory.php file using a default team and works properly.. it return an option list with the results of the query.
Also, the rest of the code seems to be correct.
The jquery is suppose to insert the ouput from getcategory.php in the id ('#optioncategory') but it doesn't.
I've already read:
http://www.lisenme.com/dynamic-dependent-select-box-using-jquery-ajax-php/
But it does not help me at all because my code is simillar and have the same structure.
Any suggestion to fix it??
Thanks in advance!

The code were incomplete. It was a missing script on the header:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Regards,

Related

Locate the reasoning for NULL values between HTML and PHP

I am trying to figure out why the resulting values are...
NULL NULL string(4) "PEAR"
..on the page they are displayed on.
Originally I do not want them to be displayed but I want the php code to run, using local storage data, when the page loads, then possibly return a boolean value or something in that direction. With a set goal in mind, I am looking for the mistake I have made that creates the NULL values. I have the following code:
validateSession.php , php functionality that will validate values from localstorage and database
<?php
include("config.php");
include("refc/refcvalidation.php");
$sesuserid = $_POST[$valuserid];
$sessionid = $_POST[$valsesid];
var_dump($sesuserid, $sessionid);
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname) or die($conn);
$stmt = $conn->prepare("SELECT * FROM sessiontable WHERE sesowner=? AND sescode=?");
$stmt->bind_param("is", $sesuserid, $sessionid);
$stmt->execute();
$result = $stmt->get_result();
$conn->close();
if ($result->num_rows > 0) {
var_dump("APPLES");
}else{
var_dump("PEAR");
}
?>
refcvalidation.php , reference coordination, ensuring same value on both pages
<?php
$valuserid = "VALSES1";
$valsesid = "VALSES2";
?>
homepage.php , basic page with contents
<?php
include("services/refc/refcvalidation.php");
include('services/validateSession.php');
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" href="general/styling.css">
<script src="general/launch.js"></script>
</head>
<body>
<div id="topBox">
</div>
<div class="box">
<form id="logForm" action="validateSession.php" method="post">
<input type="hidden" required="required" name="<?php echo $valuserid ?>" id="userfield">
<input type="hidden" required="required" name="<?php echo $valsesid ?>" id="sesidfield">
</form>
</div>
</body>
<style>
</style>
</html>
<script>
document.getElementById("userfield").value = localStorage.getItem("userid");
document.getElementById("sesidfield").value = localStorage.getItem("sessionid");
</script>
The values within HTML are set and have a value in the script section, they are null within the PHP $_POST[$valuserid]; and $_POST[$valsesid]; . Any ideas?
Have'nt tested this, but it might give you some ideas to a solution.
Maybe we could impolement some Ajax into this?
What is Ajax?
AJAX = Asynchronous JavaScript and XML. AJAX is a technique for creating fast and dynamic web pages. AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page. Ajax can give data as response.
refcvalidation.php
This should be removed
validateSession.php
<?php
include("config.php");
//include("refc/refcvalidation.php"); //REMOVED
$sesuserid = $_POST['valuserid'];
$sessionid = $_POST['valsesid'];
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname) or die($conn);
$stmt = $conn->prepare("SELECT * FROM sessiontable WHERE sesowner=? AND sescode=?");
$stmt->bind_param("is", $sesuserid, $sessionid);
$stmt->execute();
$result = $stmt->get_result();
$conn->close();
if ($result->num_rows > 0) {
$myObj->sesuserid = $sesuserid;
$myObj->sessionid = $sessionid;
$myJSON = json_encode($myObj);
echo $myJSON;
return true; //CONTAINS SOMETHING
}else{
return false; //CONTAINS NOTHING
}
?>
homepage.php
<?php
include("services/refc/refcvalidation.php");
include('services/validateSession.php');
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" href="general/styling.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="general/launch.js"></script>
</head>
<body>
<div id="topBox">
</div>
<div class="box">
<form id="logForm" action="validateSession.php" method="post">
<input type="hidden" required="required" name="<?php echo $valuserid ?>" id="userfield">
<input type="hidden" required="required" name="<?php echo $valsesid ?>" id="sesidfield">
</form>
</div>
</body>
<style>
</style>
</html>
<script>
$.ajax({
url: 'validateSession.php',
method: 'POST',
data: { valuserid: '<?php echo $valsesid ?>', valsesid: '<?php echo $valsesid ?>'},
success: function(data) {
var data_json= JSON.parse(data);
console.log(data_sjon);
localStorage.userid = data_json[0];
localStorage.sesidfield = data_json[1];
document.getElementById("userfield").value = localStorage.getItem("userid");
document.getElementById("sesidfield").value = localStorage.getItem("sessionid");
}
})
</script>

PHP and postgreSQL not returning data to AJAX

I am using AJAX - HTML - Javascript & PHP in order to extract data from postgreSQL/postGis database.
I attach below the codes of two files (html & php codes): query_nest_ajax.html & query_nest_ajax.php.
However, after the execution of the html file, nothing happen. I think I missing something.
Any help is welcome.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
</head>
<body>
<select id="btg">
<option value='BTGTN'>btgtn</option>
<option value='BTGKS'>btgks</option>
<option value='BTGTS'>btgts</option>
</select><br>
<button type="filterSubmit">Submit</button>
<hr>
<div id="resultTable"></div>
<br>
</body>
<script>
$("#filterSubmit").click(function(){
$.ajax({
url:'query_nest_ajax.php',
type:'POST',
data:{
btg: $("#btg").val()
},
success: function(response){
$("#resultTable").html(response);
}
});
});
</script>
</html>
php code:
<?php
$bs = $_POST['btg'];
$db = new PDO('pgsql:host=localhost;port=5432;dbname=Reseau_Gaz','postgres','steg1993');
$sql = $db->prepare("SELECT id_bal, btg, ST_AsGeoJSON(ST_TRANSFORM(geom_cqg,4326),5) FROM balise_reperage WHERE btg = :bs ");
$params = ["bs"=>$bs];
$sql->execute($params);
echo "<table class='table table-striped'>";
echo "<tr><th>Balise N°</th><th>Base Transport</th><th>Géométrie</th></tr>";
while ($row = $sql->fetch(PDO::FETCH_ASSOC)){
echo "<tr>";
foreach($row as $field=>$value){
echo "<td>{$value}</td>";
}
echo "</tr>";
}
echo "</table>";
?>

Using javascript/jQuery to populate a form field with database value

I have a PHP form used to submit data. This form auto-populates fields based on a case number or "id" by querying a SQL database and retrieving more data to populate other fields based on the ID. I am tasked with adding a field, but I cannot get it to auto-populate. I tried reverse-engineering the other fields, but this thing is like a spider web.
The goal is to query for a date field in the SQL DB, pull that date, and input it into the text field in the main form's #3. "PMV to MVA" input/text field.
I have redacted irrelevant code for simplicity's sake:
recoveryForm.php (the main form): User enters case number, and using the onblur="loadCase()" function, the fun begins..
<html>
<head>
<meta charset="UTF-8">
<title>Recovery Form</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script src="jquery-3.3.1.min.js"></script>
<script src="recoveryForm.js"></script>
</head>
<body>
<div class="borderdiv"><div class="innerdiv">
<h1>Recovery Template:</h1>
<p>Date: <?php echo date("Y-m-d H:i:s"); ?></p>
<form action="submit_1.php" id="mainForm" method="post">
<p>
<span class="qText" name="casenum"><b>Case Number: </b></span>
<input type="number" name="casenum_a" onblur="loadCase();" required>
</p>
<table class="mainTable" name="mainTable">
<tr>
<td><span class="qText" name="pmv_to_mva">3. PMV to MVA:</span></td>
<td><span class="qAns" name="pmv_to_mva_a">No</span></td>
</tr>
</table>
<div class="submitDiv"><input type="submit" value="Submit Form"></div>
</body>
</html>
recoveryForm.js: which contains all of the JS functions
function loadCase(){
getPMV();
document.getElementsByName("casenum1_s")[0].innerHTML=document.getElementsByName("casenum_a")[0].value;
function getPMV(){
var myCasenum=document.getElementsByName("casenum_a")[0].value;
window.alert(casenum_a);
$.post(
"getPMV.php",
{casenum: myCasenum},
function(data, status){ setPMV(data);}
);
}
function setPMV(data){
var jdata=JSON.parse(data);
document.getElementsByName("pmv_to_mva_a")[0].value=jdata.ptm;
document.getElementsByName("pmv_to_mva_a")[0].innerHTML=jdata.ptm;
}
And the getPMV.php file that's called from within the JS function:
<?php
$success=FALSE;
$postCasenum = getPostCasenum();
#header('Content-Type: application/json');
$sql = "select user_case_data.PMV_to_MVA from user_case_data WHERE casenum=?";
$conn = odbc_connect( "needles","dba","sql" );
if( $conn ) {
echo $sql;
$stmt=odbc_prepare($conn, $sql);
$queryResult=odbc_execute($stmt);
if (odbc_fetch_row($stmt)) {
$data = [
'ptm' => odbc_result($stmt,1) ? "No" : "Yes"
];
echo json_encode($data);
odbc_close( $conn );
} else {
echo "{}";
}
?>
<?php
function getPostCasenum(){
return $_POST["casenum"];
}
?>
I know the SQL query is good and returns the date value I want to update onto the form. I put the javascript inline in the last code example on this page that can be used as an example (along with jquery file and getPMV.php). No matter what I try, the json response shows blank/empty for the pmv_to_mva field, when I know that field does indeed contain data.
Anybody might be able to point me in the right direction here? Thank you.
========================== EDIT =================================
I continued to get "loadCase is not defined at HTMLInputElement.onblur", so I reasoned that there still must be some syntax error with my javascript. I decided to move the script inline to see if I could make any progress.
"Uncaught reference error: casenum_a is not defined at getPMV"...
recoveryform.php (line 16):
<input type="number" name="casenum_a" onblur="loadCase();" required>
recoveryForm.php in it's entirety:
<html>
<head>
<meta charset="UTF-8">
<title>Recovery Form</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script src="jquery-3.3.1.min.js"></script>
<!--<script src="recoveryForm.js"></script>-->
<script type="text/javascript">
function loadCase(){
getPMV();
function getPMV(){
var myCasenum=document.getElementsByName("casenum_a")[0].value;
console.log(casenum_a);
$.post(
"getPMV.php",
{casenum: myCasenum},
function(data){ setPMV(data);}
);}
function setPMV(data){
console.log(data);
var jdata=JSON.parse(data);
document.getElementsByName("pmv_to_mva_a")[0].innerHTML=jdata.ptm;
}
}
</script>
</head>
<body>
<div class="borderdiv"><div class="innerdiv">
<h1>Recovery Template:</h1>
<p>Date: <?php echo date("Y-m-d H:i:s"); ?></p>
<form action="submit_1.php" id="mainForm" method="post">
<p>
<span class="qText" name="casenum"><b>Case Number: </b></span>
<input type="number" name="casenum_a" onblur="loadCase();" required>
</p>
<table class="mainTable" name="mainTable">
<tr>
<td><span class="qText" name="pmv_to_mva">3. PMV to MVA:</span></td>
<td><span class="qAns" name="pmv_to_mva_a">No</span></td>
</tr>
</table>
<div class="submitDiv"><input type="submit" value="Submit Form"></div>
</body>
</html>
Thank you everybody for all of your help and suggestions. I was able to accomplish what I was after. My problem was somewhere in my getPMV.php file. I found success in simplifying the file. This worked:
<?php
$success=FALSE;
$postCasenum = getPostCasenum();
header('Content-Type: application/json');
$sql = "select user_case_data.PMV_to_MVA from user_case_data WHERE casenum=?";
$conn = odbc_connect( "needles","dba","sql" );
if( $conn ) {
#echo $sql;
$stmt=odbc_prepare($conn, $sql);
$queryResult=odbc_execute($stmt, array($postCasenum));
$json='{';
while(odbc_fetch_row($stmt)){
$json=$json.'"ptm":"'.odbc_result($stmt,1).'"';
}
$json=$json.'}';
echo $json;
odbc_close( $conn );
} else {
echo "{}";
}
?>
<?php
function getPostCasenum(){
return $_POST["casenum"];
}
?>

Building dependent dropdown with Ajax and Jquery: having trouble getting 2 php GET variables to show up on get_state.php - ajax is sending too

I have index.php?WORKORDER_BASE_ID=w21592 -> This is getting the work order number that I entered, that searches the MSSQL DATABASE. I call $_GET['WORKORDER_BASE_ID']; to be used to run other queries to get database results.
I need a dependent drop down. The first drop down runs the query and returns the result and it uses ajax to go to get_state.php. There it's showing up undefined varialbe/index when I try to CALL $_GET['WORKORDER_BASE_ID']; to run the 2nd query and output it in the second dropdown. How can I get around this?
<?php
require_once("dbcontroller.php");
$db_handle = new DBController();
$query ="SELECT DISTINCT R.PART_ID AS PartId, R.PART_ID + ' (' +P.DESCRIPTION + ')' AS PartFull
FROM REQUIREMENT AS R INNER JOIN PART AS P
ON R.PART_ID = P.ID
WHERE NOT EXISTS (SELECT PART_ID FROM TRACE_PROFILE TP WHERE R.PART_ID=TP.PART_ID)
AND (R.WORKORDER_BASE_ID = '".$_GET["WORKORDER_BASE_ID"]."')";
$results = $db_handle->runQuery($query);
?>
<html>
<head>
<TITLE>jQuery Dependent DropDown List - Countries and States</TITLE>
<head>
<style>
body{width:610px;}
.frmDronpDown {border: 1px solid #F0F0F0;background-color:#C8EEFD;margin: 2px 0px;padding:40px;}
.demoInputBox {padding: 10px;border: #F0F0F0 1px solid;border-radius: 4px;background-color: #FFF;width: 50%;}
.row{padding-bottom:15px;}
</style>
<script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
<script>
function getState(val) {
$.ajax({
type: "GET",
url: "index.php",
data:'PartFull='+val,
success: function(data){
$("#state-list").html(data);
}
});
}
function selectCountry(val) {
$("#search-box").val(val);
$("#suggesstion-box").hide();
}
</script>
</head>
<body>
<?
ini_set('display_errors',1);
error_reporting(E_ALL);
date_default_timezone_set('America/New_York');
$dateunix = new DateTime();
$dateunix = $dateunix->getTimestamp();
?>
<input type="textarea" name="WORKORDER_BASE_ID" rows="3" cols="5" id="WORKORDER_BASE_ID" value="<?= $_GET["WORKORDER_BASE_ID"];?>" data-theme="f" class="ui-input-text ui-body-f ui-corner-all ui-shadow-inset" required>
<input method="get" id="button" type="submit">
<h5>WORK ORDER ID:</h5><labelh5><center><? echo $_GET["WORKORDER_BASE_ID"];?></center></labelh5>
<div class="frmDronpDown">
<div class="row">
<label>Partid:</label><br/>
<select name="PartFull" id="partfull-list" class="demoInputBox" onChange="getState(this.value);">
<option value="">Select Part Id:</option>
<?php
foreach($results as $country) {
?>
<option value="<?php echo $country["PartId"]; ?>"><?php echo $country["PartFull"]; ?> </option>
<?php
}
?>
</select>
</div>
<div class="row">
<label>op seq no:</label><br/>
<select name="state" id="state-list" class="demoInputBox">
<option value="">Select Operation Seq. NO</option>
</select>
</div>
</div>
</body>
</html>
get_state.php
<!doctype html>
<html>
<head>
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, user-scalable=no" />
<title>GET STATE </title>
<!-- jQuery -->
<link href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<!-- jQuery -->
</head>
<body>
<input name="WORKORDER_BASE_ID" type="hidden" value="<?= $_GET["WORKORDER_BASE_ID"];?>" />
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
date_default_timezone_set('America/New_York');
$dateunix = new DateTime();
$dateunix = $dateunix->getTimestamp();
require_once("dbcontroller.php");
$db_handle = new DBController();
if($_GET["PartFull"] != "") {
echo $wobi;
echo $_GET['PartFull'];
echo $_GET['WORKORDER_BASE_ID'];
$query ="SELECT DISTINCT R.OPERATION_SEQ_NO AS OSN, '(' + CONVERT(VARCHAR(30), R.OPERATION_SEQ_NO) + ') ' + O.RESOURCE_ID AS Expr1
FROM OPERATION
AS O
INNER JOIN REQUIREMENT AS R
ON R.OPERATION_SEQ_NO = O.SEQUENCE_NO AND O.WORKORDER_BASE_ID = R.WORKORDER_BASE_ID
WHERE (R.WORKORDER_BASE_ID = '".$_GET['WORKORDER_BASE_ID']."') AND (R.PART_ID = '" . $_GET["PartFull"] . "')";
$results = $db_handle->runQuery($query);
?>
<option value="">Select Operation Seq. NO 2</option>
<?php
foreach($results as $state) {
?>
<option value="<?php echo $state["OSN"]; ?>"><?php echo $state["Expr1"]; ?></option>
<?php
}
}
?>
</body>
</html>

JavaScript onchange not working on dropdown element

I am creating an application that will search db and later on allow user to compare results. For that i need multiple dependable drop down menus. I am not expert coder, have some knowledge of HTML and PHP. For this i have to use Javascript.
Now if i try to use same script with diferent information that will create dropdown3, it does not work.
Here is code of index page:
<?php
require('assets/classes/manufacturer.php');
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="style/style.css" rel="stylesheet" type="text/css">
<title>Untitled Document</title>
</head>
<body>
<div id="wrapper">
<div id="sidebar">
<div id="dropdown1">
<select name="proizvodac" id="proizvodac-select">
<option value="">Odaberi Proizvođača</option>
<?php foreach($proizvodaci as $proizvodac): ?>
<option value="<?php echo $proizvodac['id']; ?>"><?php echo $proizvodac['proizvodac']; ?></option>
<?php endforeach; ?>
</select>
</div>
<div id="dropdown2">
</div>
<div id="dropdown3">
</div>
</div>
<div id="grupe">
<div id="grupa1">
</div>
<div id="grupa2">
</div>
<div id="grupa3">
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="js/global.js"></script>
</body>
</html>
And script is here:
$('#proizvodac-select').on('change', function() {
var self = $(this);
$.ajax({
url: 'http://localhost/assets/classes/model.php',
data: { proizvodac: self.val()},
success: function(data){
$('#dropdown2').html(data);
}
});
});
This should call model.php when selection is made in first dropdown, first dropdown is created from manufacturer.php that is required on start.
model.php:
<?php
require('database.php');
if(isset($_GET['proizvodac'])) {
$modelQuery = "SELECT
*
FROM auti
WHERE proizvodac_id = :proizvodac_id
";
$modeli = $db->prepare($modelQuery);
$modeli->execute(['proizvodac_id' => $_GET['proizvodac']]);
$selectedModel = $modeli->fetch(PDO::FETCH_ASSOC);
}
?>
<select name="model" id="model-select">
<option value="">Odaberi Model</option>
<?php foreach($modeli as $model): ?>
<option value="<?php echo $model['id']; ?>"><?php echo $model['model']; ?></option>
<?php endforeach; ?>
</select>
NOTE:
I have probably did something wrong when i was trying to create third dropdown that depends on second one.
EDIT: I have did something wrong, thanks kingkero for finding it.
So what i need now, if you can tell me how to get third dropdown menu and so on. I need like 10 of them. All should depend on previous one.
And if you notice some bad practice in my code, please let me know.
Now i got script for third dropdown and it is working if run from console in chrome but can't get it to work by itself.
SCRIPT HERE:
$('#model-select').on('change', function() {
var self = $(this);
$.ajax({
url: 'http://localhost/assets/classes/opcija_modela.php',
data: { model: self.val()},
success: function(data){
$('#dropdown3').html(data);
}
});
});
Thank you in advance
Your Script file should be include with in the head tag
Ex:
<?php
require('assets/classes/manufacturer.php');
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="style/style.css" rel="stylesheet" type="text/css">
<title>Untitled Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="js/global.js"></script>
</head>
<body>
<div id="wrapper">
<div id="sidebar">
<div id="dropdown1">
<select name="proizvodac" id="proizvodac-select">
<option value="">Odaberi Proizvođača</option>
<?php foreach($proizvodaci as $proizvodac): ?>
<option value="<?php echo $proizvodac['id']; ?>"><?php echo $proizvodac['proizvodac']; ?></option>
<?php endforeach; ?>
</select>
</div>
<div id="dropdown2">
</div>
<div id="dropdown3">
</div>
</div>
<div id="grupe">
<div id="grupa1">
</div>
<div id="grupa2">
</div>
<div id="grupa3">
</div>
</div>
</div>
</body>
</html>

Categories