I'm trying to make a website that when you click the application it opens it and it works at the moment but opens every single application, which obviously i don't want.
I believe i need to put a foreach loop so for every application it puts a different$appLocation` in?
This is just a first project for me so maybe if someone can point me in the right direction.
<?php
$appQuery = "SELECT app_name, app_location, app_status, app_image FROM applications";
$select_posts = mysqli_query($conn, $appQuery);
if ($result = mysqli_query($conn, $appQuery)) {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
$appName = $row['app_name']; // List Application Name
$appLocation = $row['app_location']; // List Application Location
$appStatus = $row['app_status']; // List Application Status - 1 = Enabled / 0 = Disabled
$appImage = $row['app_image']; // List Application Image Locations
?>
<!-- Tile with image container -->
<div class="tile">
<div class="tile-content">
<div class="image-container">
<form method="post">
<div class="frame">
<button name="appButton"><img src="<?php echo $appImage ?>"></button>
</div>
</form>
<?php
if (isset($_POST['appButton'])) {
exec("start $appLocation");
}
?>
</div>
</div>
</div>
<?php
}
?>
$select_posts = mysqli_query($conn, $appQuery);and as the buttons are all named the same clicking any one of them will trigger ALL apps to launch