Hello All,
I am using PHP to generate dynamic dropdown, the dropdown list items are fetched from database.
Here's the php code for that and it works.
<select name="title[]" id="title">
<?php $categories = Category::find_by_cid(5); foreach($categories as $category): ?>
<option value="<?php echo $category->name; ?>"><?php echo $category->name; ?></option>
<?php endforeach; ?>
</select>
What i want to do is, Using jQuery whenever a link with id AddNew is clicked, a new dropdown should appear below that, containing same values.
Also, is there any way to execute php code inside javascript??
ex :
<script>
var name = "<?php echo $user->name; ?>";
</script