I have a page that is taking values, seperated by a new line, in a database.
The values are id numbers for other articles in the db.
I have written code to take all the values in the db field and place them in an array.
The page has a list menu populated with every single article in the db, and I would like any articles that have the same id as one of the articles in the array to appear as already selected.
The array is working fine and I have echoed "$ifstatement" and that is fine.
The code is as follows:
I am getting a parse error on the "if(eval($ifstatement)) { ?>" line
The values are id numbers for other articles in the db.
I have written code to take all the values in the db field and place them in an array.
The page has a list menu populated with every single article in the db, and I would like any articles that have the same id as one of the articles in the array to appear as already selected.
The array is working fine and I have echoed "$ifstatement" and that is fine.
The code is as follows:
Code:
<?
$i=0;
foreach(explode("\n", $editRS['internallinks']) as $intlinks)
{
$i++;
$intlinkarray[$i] = $intlinks;
if($i > 0) {
}
}
?>
<select name="internal[]" size="15" multiple="multiple" id="internal[]">
<?
while ($internalRS = mysql_fetch_array($internalresults)) {
?>
<option value="<?= $internalRS['articleid'] ?>"
<?
$j = 1;
$z = 1;
$articleid = $internalRS['articleid'];
$ifstatement = '$intlinkarray['.$z.'] == ' .$articleid;
if ($i > 1) {
while ($j < $i) {
$z++;
$j++;
$ifstatement .= ' || $intlinkarray['.$z.'] == ' .$articleid;
}
}
if($i > 0) {
if(eval($ifstatement)) { ?>
selected="selected"
<? }
}
?>
>
<?= $internalRS['articletitle'] ?>
</option>
<? } ?>
</select>
I am getting a parse error on the "if(eval($ifstatement)) { ?>" line