[Solved] How to get results from php to html option?


I don’t really understand what you mean. But did you mean something like this:

<html>
<body>
<select>
<?php
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include "$root/config.php";

$something1 = "something1";
$something2 = "something2";

$stmt = $pdo->prepare('SELECT DISTINCT from_mysql FROM customers WHERE something1 = :something1 AND from_mysql != :something2 ORDER BY from_mysql');
$stmt->execute(array(':something1' => $something1, ':something2' => $something2));

$results = $stmt->fetchAll();

if (empty($results)) { 
    echo 'Error: Please contact technical support!'; 
} else {
foreach( $results as $row ) {
    echo "<option>".$row['from_mysql']."</option>";
}
}
?>
</select>
</body>
</html>

P.S. You’ll have to use index.php

1

solved How to get results from php to html