What I would like to do is find a way to "hide" the option value listing from the page source if possible.
I have successfully created a page with multiple drop downs (6 now, will be 15+ in total); database queries are working, drop downs are working, posting selections and results are visible in a separate processing page, HOWEVER; The option values are showing in the page source.
Page Design (for this example) test.php - contains db connect (will change that to separate include_once later), queries, option values code, and table data. index.php - contains only an include statement calling test.php.
Running test.php in a browser exposes queries (which I don't want) and loading the index that is including test.php hides queries, but shows options which I prefer not to have. I have searched everywhere (maybe I am not asking the question properly) and have tried to run the sql in one page and posted the result to another, but I cannot get it to work.
What I wanted to do: Run MySQL queries in a separate "function" page and then call the output (select name) to another (HTML) page and embed the dropdowns into a cell of a table.
Questions:
- Is it possible to hide the option values in the index.php page?
- Is this my design flaw and if so, what is a better way?tem
- How do I run queries in one page, and then call the output of that query as a drop down into an HTML page?
test.php (Shortened example)
<!--mo-->
<td colspan="2"><div align="right"><font face="Arial, Helvetica, sans-serif">
<?php
$query = "SELECT date_code_mo, date_code_mo_desc FROM tbl_gm_assy_date_code_mo ORDER BY date_code_mo ASC";
echo '<select name="date_mo">';
if ($result = mysqli_query($link, $query)) {
while ($row = mysqli_fetch_assoc($result)) {
echo '<option value="' . $row['date_code_mo_desc'] . '">' . $row['date_code_mo'] . '</option>';
}
mysqli_free_result($result);
}
echo '</select>';
?>
</font></div></td>
<!--week-->
<td colspan="2"><div align="left"><font face="Arial, Helvetica, sans-serif">
<?php
$query = "SELECT date_code_wk, date_code_wk_desc FROM tbl_gm_assy_date_code_wk ORDER BY date_code_wk ASC";
echo '<select name="date_wk">';
if ($result = mysqli_query($link, $query)) {
while ($row = mysqli_fetch_assoc($result)) {
echo '<option value="' . $row['date_code_wk_desc'] . '">' . $row['date_code_wk'] . '</option>';
}
mysqli_free_result($result);
}
echo '</select>';
?>
index.php source (table definitions not shown)
<select name="date_mo"><option value="Janurary">01</option><option value="Feburary">02</option><option value="March">03</option><option value="April">04</option><option value="May">05</option><option value="June">06</option><option value="July">07</option><option value="August">08</option><option value="September">09</option><option value="October">10</option><option value="November">11</option><option value="December">12</option></select>
<select name="date_wk"><option value="First">A</option><option value="Second">B</option><option value="Third">C</option><option value="Fourth">D</option><option value="Fifth">E</option></select>
I have used a lot of examples available on here to get this far, and I am sure it is something small that has been missed, regardless, THANKS TO YOU ALL!