- your own data for connecting to MySQL, in the $mysql array.
- the table name, in the $table variable.
- the name of the columns with Options, and the text for each Select list, in the array $col_sel.
// HERE add the name of the table $table ='sites'; // HERE add the columns that will be used for <select> lists, // and the Text that will be displayed to the <select> associated to each column ('column_name'=>'text') $col_sel = array('mark'=>'Sel:mark', 'year'=>'Sel:year', 'color'=>'Sel.3');• If (for example) the table has other two columns named: "cdata", "cnt", for descriptions /content that is displayed to each select list (according to the selected option) change the value of the $col_desc variable like this:
//HERE you can add columns with data for description /content //Let it empty ( array(() ) if you not use column for description $col_desc = array('cdata', 'cnt');• And finally, in the $sel_desc variable add the selected list (columns) for which to display description, after it is selected an option. For example, in the table "cars", if you want to display descriptions only when it is selected an option in the "year" and "color" lists, set $sel_desc like this:
//HERE add the selected list (columns) for which to display description, after it is selected an option $sel_desc = array('year', 'color');If you want to display only the three select lists (mark, year, color), or you not have a column with description, let empty the array in the $col_desc variable, array().
Select: <div id="msla2"></div>- Then, include the "msla2.js" script after that Div, by adding the following code:
<script src="path_to/msla.js"></script>
{ "col": "column name", "sel_txt": "text for <select>", "opt": ["option_1", "option_2", "..."], "descr": "description 1, description 2, ..." }- "col" contains the column name from MySQL table, which stores the options for Select list
//sets data in 'descr', each row with all columns for description is added in <div>, each description in <span> if($cols[0] !=$col && $nrc >0 && in_array($cols[$col_i], $sel_desc)){ for($i=0; $i<$nrc; $i++){ $re_msla2['descr'] .='<span>'. $row[$col_desc[$i]] .'</span>'; } $re_msla2['descr'] ='<div class="msla2_descr">'. $re_msla2['descr'] .'</div>'; }
If you want to include the select drop down lists into a form, and then to send and use the selected options in other PHP script, you can get the selected value using the "name" of each select, which is the same as the column name with the options for that select, added in the $col_sel variable.
- For example, the first <select> has name="col_select1" (the first value added in the $col_sel array). To get the selected option of this dropdown list, use in your PHP script: $_POST['col_select1'].
The second Select list has name="col_select2" (the second value added in the $col_sel array), and so on.
<table><tr> <th>Title 1</th> <th>Title 2</th> </tr></table>
.some_class { line-height: 150%; }
document.getElementById("id_button").onclick = function(){ window.open("http://coursesweb.net/"); }
$ar_dir = scandir("dir_name"); var_export($ar_dir);