I know this can be done, but I'm having problems finding an example of it.
Here's what I'm trying to do:
I've got php/mysql data coming in from a database into a css-scrollbox and want that
dynamic text (summary data) to be selectable. When selected, I want to display the detail field from
the record selected, into another display box area on the same screen. Sort of like a 'reader.'
Any examples?
Need help with scrollbox with dynamic php/mysql data
Moderator: General Moderators
Need help with scrollbox with dynamic php/mysql data
Last edited by redtail on Thu Feb 18, 2010 6:22 pm, edited 1 time in total.
Re: Need help with scrollbox with dynamic php/mysql data
redtail, I will assume that array $array contains the values from the database.
I didn't test the above, let me know if it doesn't work
Code: Select all
function selectOne($array=null)
{
echo "<form action=\"\" method=\"post\">";
echo "<SELECT name=anyName>";
echo "<OPTION value=''>please choose one</OPTION>";
foreach ($array as $key=>$value){
echo "<OPTION value=$value>$value</OPTION>";
}
echo "</SELECT>";
echo "<input name=\"sent\" type=\"hidden\" value=\"yes\">";
echo "<input type=\"Submit\" value=\"Go!\">";
echo "</form>";
return null;
}Re: Need help with scrollbox with dynamic php/mysql data
Hi Manohoo,manohoo wrote:redtail, I will assume that array $array contains the values from the database.
I didn't test the above, let me know if it doesn't workCode: Select all
function selectOne($array=null) { echo "<form action=\"\" method=\"post\">"; echo "<SELECT name=anyName>"; echo "<OPTION value=''>please choose one</OPTION>"; foreach ($array as $key=>$value){ echo "<OPTION value=$value>$value</OPTION>"; } echo "</SELECT>"; echo "<input name=\"sent\" type=\"hidden\" value=\"yes\">"; echo "<input type=\"Submit\" value=\"Go!\">"; echo "</form>"; return null; }
It looks like that will create a pull-down list. I don't think that's quite what I need. Here's a code
snippet of what I've got in a css-scrollbox, so far. I want to make these dynamic records selectable so that I can display the
corresponding large text field into another display box when one of these rows is selected.
for ($n=0; $n < $num_results_notes_all; $n++) {
if ($n%2) {
$backgrnd_color = 'row1';
} else {
$backgrnd_color = 'row2';
}
$row_notes_all = mysql_fetch_assoc($result_notes_all);
echo '<tr class=';
echo '"'.$backgrnd_color.'">';
echo '<td style="width: 218px; text-align: left;">';
echo htmlspecialchars(stripslashes($row_notes_all['description']));
echo ' ';
echo '</td><td style="width: 90px; text-align: left;">';
echo htmlspecialchars(stripslashes($row_notes_all['note_date']));
echo '   ';
echo '</td><td style="width: 88px; text-align: left;">';
echo htmlspecialchars(stripslashes($row_notes_all['note_time']));
echo '  ';
echo '</td></tr>';
}