[eluser]jshultz[/eluser]
I'm not sure what I'm missing here. If I take the if/foreach/endif block out, then everything works fine. However, if I put that block in, then I get "Fatal error: Cannot use object of type stdClass as array" on "'type' => $row['@attributes']['type']," However, like I said, if that for php block is gone then it works just fine. I even hardcoded a select block in it's place and it works ok. Am I just missing something? I have the exact same block of code in another location on the page and it's not causing any errors anywhere around it. I'm lost.
Code:
<td><?php echo form_open_multipart('/callcenter/school_submit/'); ?>
<div class="span-4">
<select name="agent">
<?php if (isset($agents) && count($agents)) : foreach ($agents->result() as $row): ?>
<option value="<?=$row->agentid?>"><?=$row->agent_name?></option>
<?php endforeach ?>
<?php endif ?>
</select>
</div>
<?php
$data = array(
'lead_number' => $lead_number,
'network' => 'cb',
'type' => $row['@attributes']['type'],
'client_id' => $row['@attributes']['client_id'],
'id' => $row["@attributes"]["id"],
'link' => $row['link'],
'source' => $source,
);
echo form_hidden($data);
echo form_submit('submit', 'Record Lead');
echo form_close();
?>
</td>