For user’s assignment of bottom limit to top limit I created two input boxes based on the same “counter list” derived
from a “MySql” table.
<?php // first_form.php
require_once 'myInitial.php';
require_once 'myLogin.php';
MYSQLI_SET_CHARSET($myConnection,'UTF8');
echo <<<_END
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>form-input_list_select</title>
<style>
.extraction
{
border-radius:10px;
box-shadow:0 0 3px #AAA;
-webkit-box-shadow: inset 3px 3px 0px 0px #808080;
-moz-box-shadow: inset 3px 3px 6px 0px #808080;
box-shadow: inset 3px 3px 6px 0px #808080;
direction:rtl;
max-width:80%;
height:20%;
background:#ffffff;
margin:10px auto;padding:10px;
overflow:auto;
}
</style>
</head>
<body>
<table>
<td>
<form method = "post" action = "first_form.php">
<input type="list" class = "extraction"
required aria-required="true" placeholder="from"/>
_END;
$myQue = "select counter from hourshifts";
$myResult = $myConnection->query($myQue);
if (!$myResult) die ("Database access failed: " . $myConnection->error);
$numOfRows = $myResult->num_rows;
echo "<select name='counters'>";
for ($j = 0 ; $j < $numOfRows ; $j++)
{
$myResult->data_seek($j);
$row=$myResult->fetch_array(MYSQLI_ASSOC);
echo "<option>{$row['counter']}</option>";
}
echo <<<_END
<input type="list" class = "extraction"
required aria-required="true" placeholder="to"/>
_END;
$myQue = "select counter from hourshifts";
$myResult = $myConnection->query($myQue);
if (!$myResult) die ("Database access failed: " . $myConnection->error);
$numOfRows = $myResult->num_rows;
echo "<select name='counters'>";
for ($j = 0 ; $j < $numOfRows ; $j++)
{
$myResult->data_seek($j);
$row=$myResult->fetch_array(MYSQLI_ASSOC);
echo "<option>{$row['counter']}</option>";
}
echo <<<_END
</form>
</td>
</table>
_END;
?>
The same option list is created twice !
Is there a way to create same option list for two different input boxes in a function or an array ?
Another question is the CSS. The list and selected value are positioned outside the box ! I know this is not a CSS forum and if
I dont get the answer I’ll address it to the CSS forum.
Thanks !