Does anyone know if it's possible to store php & MySQL script in a string and NOT have it executed until desired?
I've got the normal mysql drop down menus running (see below), but I would like to execute them from a referenced string. This probably runs against how the interpreter works, but I'm sort of curious.
I'm storing HTML & JavaScript in a string and then echoing it out from a template function (it uses a stored template, then spits out the HTML data through a function using "echo" so the data appears nicely within a standardized page). The problem comes up when I come across some of my PHP code and try to store that for later processing. I'm suspicious that the echo time is the wrong time to execute the PHP & MySQL stuff.
Any comments would be helpful.....
<?php
echo "<select name='MyCounty' size='1'>";
$query = "Select * from Counties ORDER BY County asc";
$result = mysql_query($query);
$RowNum = mysql_numrows($result);
$i = 0;
WHILE ($i < $RowNum) {
$row=mysql_fetch_array($result);
$MCounty=$row["County"];
echo "<option value='$MCounty'>$MCounty</option>";
$i++;
}
echo "</select>";
}
?>