include or function
| From: | John Taylor-Johnston | Date: | Fri, 07 Mar 2003 00:34:48 +0000 |
| Subject: | include or function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-138543@lists.php.net to get a copy of this message | ||
I have an *.inc with html, a rather long list of <options>. I want to clean this up some.
I'm going to declare $FieldName and $ToBeSelected before I call
include("options.inc"). I also want to select one of the <options> in advance.
The problem is ... this is beginning to look like a function, which I will declare 10 times like a
function. How can I clean up/streamline this code?
<?php
$ToBeSelected "<OPTION value=\"ST\" selected>ST</OPTION>";
$FieldName = "Field1";
include("options.inc");
?>
------snip "options.inc"------
<SELECT NAME="<?php echo"$FieldName"; ?>">
<OPTION value="">Choose One</OPTION>
<?php echo $ToBeSelected; ?>
<OPTION value="AU">AU</OPTION>
<OPTION value="ST">ST</OPTION>
<OPTION value="BT">BT</OPTION>
...18 options...
</SELECT>