Hi all:
I am calling a dynamic drop box. the think is, I need to run this drop down in 2 separate spots on the same page. I am coding procedurally.
What is the best way to tackle this? I am sure writing it out twice isn't it! Do I make it an include? Thanks!!!
$sql = "SELECT l_id, Player, Promoter, EventDate FROM Events WHERE (MailOrder = '1' OR AdvanceTix = '1') AND ListingDate = convert(char(24),getdate(),1) ORDER BY Player, EventDate";
$stmt = sqlsrv_query($conn, $sql);
?>
<select name="l_id" size="1">
<?php
echo "<option value = '" . $_SESSION["l_id"] . "'>" .$_SESSION["player"] . " " . $_SESSION["promoter"] . " " . $_GET["eventDate"] . "</option>";
while($result = sqlsrv_fetch_array($stmt)){
$rPlayer = $result["Player"];
$rPromoter = $result["Promoter"];
$rL_id = $result["l_id"];
if (isset($result["EventDate"])){
$rEventDate = date_format($result["EventDate"],"m/d/Y");
} elseif (isset($_GET["eventDate"])){
$rEventDate = date_format($_GET["eventDate"],"m/d/Y");
} else {
$rEventDate = "";
}
echo "<option value = '" . $rL_id . "'>" . $rPlayer . " " . $rPromoter . " " . $rEventDate . "</option>";
}
?>
</select>