I'm trying to pull values from a stored array (comma separated) and use the values for a drop down list. Here is the code I have so far. I've tried a few variations but the other all throw errors. This one has no errors but does not appear to be pulling the array... this would be on the edit screen for a record accessed through ChronoConnectivity but the code is on the form in ChronoForms...
<?php
$db =& JFactory::getDBO();
$query = "
SELECT `interior`
FROM `airplanes`;
";
$db->setQuery($query);
?>
<tr><td>
<table width="400" border="0" cellpadding="3">
<?php
$listArray = explode(', ', $MyRow->interior);
echo '<select name="testSelect" id="testId">';
foreach ($listArray as $item)
echo '<option value="'.htmlspecialchars($item).'">'. htmlspecialchars($item) . "</option>\n";
echo '</select>';
?>
Hi zandergraphics,
You are getting all the 'interior' values from the database; is each of these a comma-separated list? What is the difference between $MyRow->inerior and $MyRow_intertior_all?? I don't see how this is supposed to translate into lists of checkboxes and drop-down options?
There are several things wrong with your code - to start with $MyRow isn't defined in ChronoForms. But hard to suggest fixes without better understanding.
Bob
You are getting all the 'interior' values from the database; is each of these a comma-separated list? What is the difference between $MyRow->inerior and $MyRow_intertior_all?? I don't see how this is supposed to translate into lists of checkboxes and drop-down options?
There are several things wrong with your code - to start with $MyRow isn't defined in ChronoForms. But hard to suggest fixes without better understanding.
Bob
Yeah, they all should have been 'interior'. Both interior and interior all are arrays and I've tried it both ways. Looks like I had an extra bit that somehow got pasted in there, probably something to do with the fact that it was 2am by the time I broke down and posted. Obviously, I'm not quite an expert at this quite yet, but learning. I also tried:
with no luck either.
I guess $MyRow-> only works in connections, not in forms? Guess I was thinking it would work either place.
$interior = explode(',',$row['interior']);with no luck either.
I guess $MyRow-> only works in connections, not in forms? Guess I was thinking it would work either place.
This topic is locked and no more replies can be posted.
