Constructing <select><option> list with SELECT results
Posted: Sat Oct 06, 2018 8:50 am
Hello:
I hope this is the correct forum for this question.
I am trying to construct a dynamic <select><option> list based off of results from a SELECT statement. And I'm running into problems. Specifically - the final output looks like the attached .png file.
There is an extra \ slash in the last </option> tag. Even though I don't have the \ slash in the code snippet. Following is my code snippet. Does anyone have any idea why the forward slash is being inserted into my </option> tag????
Thanks in advance - Pavilion
I hope this is the correct forum for this question.
I am trying to construct a dynamic <select><option> list based off of results from a SELECT statement. And I'm running into problems. Specifically - the final output looks like the attached .png file.
There is an extra \ slash in the last </option> tag. Even though I don't have the \ slash in the code snippet. Following is my code snippet. Does anyone have any idea why the forward slash is being inserted into my </option> tag????
Code: Select all
$prep_LogAccess = $link->prepare($select_LogAccess);
$prep_LogAccess->execute(array());
$list = "<option value=''>test</option>";
$LogAccess_Results = $prep_LogAccess->fetchAll();
foreach($LogAccess_Results as $LogAccess) {
$list = $list . "<option class='optPrivileges' value=" . $LogAccess['ActivityCode'] . ">" . stripslashes($LogAccess['ActivityDesc']) . "</option>";
}
echo(json_encode($list));