Hi everyone,
I'm trying to create a "from - to" selection area where the user selects his "from" number to "to" number.
The numbe choise is derived from a mysql table "hourshifts" and a column named "counter" .
This is my code:
This is what the display looks like after yhe user selected the "from" number.
The number selected, 19, is placed outside the input box.
Can anyone help me with placing the selected numbers inside their input boxes?
My second question is: How can I access the number selected with php? It is shown on the screen whereby en "echo" command
but is it stored inside a variable or an array such as $_post?
Thanks
I'm trying to create a "from - to" selection area where the user selects his "from" number to "to" number.
The numbe choise is derived from a mysql table "hourshifts" and a column named "counter" .
This is my code:
Code:
<?php // select_list_from_query1.php
require_once 'myInitial.php';
require_once 'myLogin.php';
MYSQLI_SET_CHARSET($myConnection,'UTF8');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>select_list_from_query1</title>
<link rel="stylesheet" href="css/table2.css">
</head>
<body>
<table>
<td>
<form method = "post" action = "first_form.php">
<input type="list" class = "extraction"
required aria-required="true" placeholder="from"/>
<?php
$myQue = "select counter from hourshifts";
$myResult = $myConnection->query($myQue);
if (!$myResult) die ("Database access failed: " . $myConnection->error);
$numOfRows = $myResult->num_rows;
?>
<select name='counters'>
<?php
for ($j = 0 ; $j < $numOfRows ; $j++)
{
$myResult->data_seek($j);
$row=$myResult->fetch_array(MYSQLI_ASSOC);
?>
<option><?php echo $row['counter'] ?></option>
<?php
}
?>
<input type="list" class = "extraction"
required aria-required="true" placeholder="to"/>
<?php
$myQue = "select counter from hourshifts";
$myResult = $myConnection->query($myQue);
if (!$myResult) die ("Database access failed: " . $myConnection->error);
$numOfRows = $myResult->num_rows;
?>
<select name='counters'>
<?php
for ($j = 0 ; $j < $numOfRows ; $j++)
{
$myResult->data_seek($j);
$row=$myResult->fetch_array(MYSQLI_ASSOC);
?>
<option><?php echo $row['counter'] ?></option>";
<?php
}
?>
</form>
</td>
</table>
</body>
</html>
The number selected, 19, is placed outside the input box.
Can anyone help me with placing the selected numbers inside their input boxes?
My second question is: How can I access the number selected with php? It is shown on the screen whereby en "echo" command
but is it stored inside a variable or an array such as $_post?
Thanks