help! I am currently working on getting the content of by class name using Javascript and store them into an array. Display array into drop-down list using php. This page is .php
What i have done so far:
Javascript:
var array = new Array();
$('.headline-bar').each(function () {
array.push(this.innerHTML);
array.serializeArray();
});
PHP :
<?php
$arrays = json_decode($_POST['array'], true);
foreach($arrays as $name) { ?>
<option value="<?= $name['name'] ?>"><?= $name['name'] ?></option>
<?php
} ?>
Html:
<select>
<option selected="selected">All</option>
<?php
$arrays = json_decode($_POST['array'], true);
foreach($arrays as $name) { ?>
<option value="<?= $name['name'] ?>"><?= $name['name'] ?></option>
<?php
} ?>
</select>
<input type="submit" value="Submit">
<form action="#" id="release_year" method="post" >
<div class="headline-bar">2015</div>
<div class="headline-bar">2014</div>
</form>