<h1>View Log</h1>
<?php
$timezone = "America/Chicago";
date_default_timezone_set($timezone);
$today = date("Y-m-d");
?>
<?php
$serverName = 'Server\SQLEXPRESS';
$connectionInfo = array('Database'=>'database', 'UID'=>'username', 'PWD'=>'password','ReturnDatesAsStrings'=>true,);
$connection = sqlsrv_connect($serverName, $connectionInfo);
$query = ' SELECT ForteID
FROM database.dbo.Reps
ORDER By ForteID';
$result = sqlsrv_query($connection,$query);
// Move the data to a simple array to simplify presentation code.
$resultAsArray = array();
while ( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC )) {
$resultAsArray = $row;
}
?>
<form method="get" action="getlog.php">
<select>
<?php foreach ($resultAsArray as $row): ?>
<option value="<?php= $row['ForteID'] ?>"><?php= $row['ForteID'] ?></option>
<?php endforeach; ?>
</select>
<BR>
<table>
<tr>
<td>Start Date:</td>
<td><input name="start_date" type="date" value="<?php echo $today;?>" autocomplete="off" required="required"></td>
</tr>
<tr>
<td>End Date:</td>
<td><input name="end_date" type="date" value="<?php echo $today;?>" autocomplete="off" required="required"></td>
</tr>
</table>
<br>
<input type="submit" name="getLog" value="Get Log"><br><br>
<input type="button" value="Back to Form" onclick="window.location.href='index.php';"> <br>
</form>
</html>
My result for the drop down box is nothing. I believe something is wrong with the
while ( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC ))
Thanks in advance for the help.