I've made something like a crud system for employees.
The user can input informations about the employees. Under others, there is a 'select' input with couple of options that come from the database. When I fill out the form, and submit it, the data gets to the database.
But when I want to edit the form, the 'select' input gets another value, even if I don't change anything there. So I need something to echo the already inputed value from the option.
This is my foreach loop that I use to loop the categories:
<?php
$i = 0;
foreach($categories as $key => $category) {
?>
<option value="<?php echo $category; ?>"><?php echo $category; ?></option>
<?php
$i++;
}
?>
How to get the value from the database that was selected and stored there. Thanks
$categoriesdata from your SQL query? Or are you asking how to connect to a Database and output each category associated within the database corresponding to that array? It's pretty unclear, like your code. - Jaquarh$i++? For what you need it? - Twinfriends