Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I pass Ajax var result to PHP code?

Status
Not open for further replies.

kristo5747

Programmer
Mar 16, 2011
41
US
**Disclaimer: It's been a while since I last wrote any code. The quality of my code is likely to be sub-par. You've been warned.**

Greetings.

I am coding a basic form that uses a SELECT list I populate from my database.

However, my user needs the form to be dynamic and wants to be able to select either `MasterTable1` or `MasterTable2` or `MasterTable3`...

Instead of hardcoding the table name for the database query that populates the SELECT list, I attempted to implement a basic Ajax action (used example from that's when I lost my sanity...

I can output `<div id='txtHint'></div>` in my page and it shows the correct table name that was picked.

But how do I pass the correct table name to my query that will populate my SELECT list???

I tried

Code:
     <select name="DBFilename" id="DBFilename" size="0"> 
     <option value="">Select Filename</option> 
    <?php 
    $sql="select distinct filename from "."<div id='txtHint'></div>";
    $result = mysql_query($sql);
     while ($row = mysql_fetch_array($result)){ ?>  
     <option value="<?php echo $row['filename']; ?>"><?php echo $row['filename']; ?></option> 
     <?php } ?> 
     </select>

But to no avail. This is confusing since I can do this...

Code:
    ...
        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET","gettable.php?q="+str,true);
    xmlhttp.send();
    }
    </script></head>
    <body><form><select name="SrcTbl" id="SrcTbl" size="0" onchange="showTable(this.value)"> 
    	<option value="">Select Data Table</option> 
    	<option value=""> </option> 
	<option value="MasterTable1">up to 31 days old</option> 
	<option value="MasterTable2">62 days old</option> 
    </select>
    </form><br /><div id="txtHint"><select name="tabList"><option></option></select> </div>
    </body></html>

And the name of my table will be displayed in the SELECT list 'tablist'.

How do I pass the correct table name to my query that will populate my SELECT list? Thanks!!

Form code in pastebin.com =>
 
To clarify...

That <div> is supposed to end up being the table name that is returned by the Ajax script.
 
remember that php web applications (and most web apps) are stateless. you cannot interrupt output to the browser to wait for user input.

data sent to the server by ajax is accessible either in the $_POST or $_GET superglobal depending on the method employed.

i have cleaned up your code a bit and added some ajax functionality for the display of the final results. hopefully you can see how things work and thus take it on from here. your code is weak on security and exposed to normal attack vectors so don't deploy this anywhere vulnerable and when you're ready read up on security generally.

Code:
[COLOR=#990000 ]<?php[/color]
[b][COLOR=#000000 ]ini_set[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'error_reporting'[/color][COLOR=#990000 ],[/color] true[COLOR=#990000 ]);[/color]
[b][COLOR=#000000 ]error_reporting[/color][/b][COLOR=#990000 ]([/color]E_ALL [COLOR=#990000 ]^[/color] E_NOTICE[COLOR=#990000 ]);[/color]
[b][COLOR=#000000 ]define[/color][/b][COLOR=#990000 ]([/color]MYDIR[COLOR=#990000 ],[/color] [COLOR=#009900 ]$_SERVER[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'DOCUMENT_ROOT'[/color][COLOR=#990000 ]].[/color][COLOR=#FF0000 ]"/filedepot"[/color][COLOR=#990000 ]);[/color]
[COLOR=#009900 ]$host[/color][COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]'localhost'[/color][COLOR=#990000 ];[/color]
[COLOR=#009900 ]$user[/color] [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]'vatroot'[/color][COLOR=#990000 ];[/color]
[COLOR=#009900 ]$pwd[/color] [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]'ork'[/color][COLOR=#990000 ];[/color]
[COLOR=#009900 ]$db[/color] [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]'dev'[/color][COLOR=#990000 ];[/color]

[COLOR=#009900 ]$con[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]mysql_connect[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$host[/color][COLOR=#990000 ],[/color] [COLOR=#009900 ]$user[/color][COLOR=#990000 ],[/color] [COLOR=#009900 ]$pwd[/color][COLOR=#990000 ]);[/color]
[b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ](![/color][COLOR=#009900 ]$con[/color][COLOR=#990000 ])[/color] [COLOR=#FF0000 ]{[/color]
[tab][b][COLOR=#0000FF ]die[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'Could not connect: '[/color][COLOR=#990000 ].[/color][b][COLOR=#000000 ]mysql_error[/color][/b][COLOR=#990000 ]());[/color]
[COLOR=#FF0000 ]}[/color]
[b][COLOR=#000000 ]mysql_select_db[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$db[/color][COLOR=#990000 ],[/color] [COLOR=#009900 ]$con[/color][COLOR=#990000 ])[/color] [b][COLOR=#0000FF ]or[/color][/b] [b][COLOR=#0000FF ]die[/color][/b][COLOR=#990000 ]([/color][b][COLOR=#000000 ]mysql_error[/color][/b][COLOR=#990000 ]());[/color]

[b][COLOR=#0000FF ]function[/color][/b] [b][COLOR=#000000 ]check_search[/color][/b][COLOR=#990000 ]()[/color] [COLOR=#FF0000 ]{[/color]
[tab][COLOR=#009900 ]$errors[/color] [COLOR=#990000 ]=[/color] [COLOR=#009900 ]$results[/color] [COLOR=#990000 ]=[/color] null[COLOR=#990000 ];[/color]
[tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color][b][COLOR=#0000FF ]isset[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_POST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'submit'[/color][COLOR=#990000 ]]))[/color] [COLOR=#FF0000 ]{[/color]
[tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ](![/color] [b][COLOR=#0000FF ]empty[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_POST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'DBFilename'[/color][COLOR=#990000 ]]))[/color] [COLOR=#FF0000 ]{[/color]
[tab][tab][tab][COLOR=#009900 ]$results[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]doFileSearch[/color][/b][COLOR=#990000 ]();[/color]
[tab][tab][COLOR=#FF0000 ]}[/color]
[tab][COLOR=#FF0000 ]}[/color] [b][COLOR=#0000FF ]else[/color][/b]
[tab][tab][COLOR=#009900 ]$errors[/color] [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]"Please select an option before you hit SUBMIT."[/color][COLOR=#990000 ];[/color]
[tab][b][COLOR=#0000FF ]return[/color][/b] [b][COLOR=#000000 ]Array[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$results[/color][COLOR=#990000 ],[/color] [COLOR=#009900 ]$errors[/color][COLOR=#990000 ]);[/color]
[COLOR=#FF0000 ]}[/color]

[b][COLOR=#0000FF ]function[/color][/b] [b][COLOR=#000000 ]doFileSearch[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$table[/color][COLOR=#990000 ]=[/color]null[COLOR=#990000 ],[/color] [COLOR=#009900 ]$DBFilename[/color][COLOR=#990000 ]=[/color]null[COLOR=#990000 ])[/color] [COLOR=#FF0000 ]{[/color]
[tab][COLOR=#009900 ]$result[/color] [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]''[/color][COLOR=#990000 ];[/color]
[tab]
[tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color] [b][COLOR=#0000FF ]empty[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$DBFilename[/color][COLOR=#990000 ])[/color] [COLOR=#990000 ]&&[/color] [b][COLOR=#0000FF ]empty[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_POST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'DBFilename'[/color][COLOR=#990000 ]]))[/color][b][COLOR=#0000FF ]return[/color][/b] null[COLOR=#990000 ];[/color]
[tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color] [b][COLOR=#0000FF ]empty[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$table[/color][COLOR=#990000 ])[/color] [COLOR=#990000 ]&&[/color] [b][COLOR=#0000FF ]empty[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_POST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'SrcTbl'[/color][COLOR=#990000 ]]))[/color] [b][COLOR=#0000FF ]return[/color][/b] null[COLOR=#990000 ];[/color]
[tab]
[tab][COLOR=#009900 ]$DBFilename[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]isAjax[/color][/b][COLOR=#990000 ]()[/color] [COLOR=#990000 ]?[/color] [COLOR=#009900 ]$DBFilename[/color] [COLOR=#990000 ]:[/color] [COLOR=#009900 ]$_POST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'DBFilename'[/color][COLOR=#990000 ]];[/color]
[tab][COLOR=#009900 ]$table[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]isAjax[/color][/b][COLOR=#990000 ]()[/color] [COLOR=#990000 ]?[/color] [COLOR=#009900 ]$table[/color] [COLOR=#990000 ]:[/color] [COLOR=#009900 ]$_POST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'SrcTbl'[/color][COLOR=#990000 ]];[/color]
[tab][i][COLOR=#9A1900 ]//add some escaping.  this is imperfect[/color][/i]
[tab][COLOR=#009900 ]$table[/color] [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]'`'[/color] [COLOR=#990000 ].[/color] [COLOR=#009900 ]$table[/color] [COLOR=#990000 ].[/color] [COLOR=#FF0000 ]'`'[/color][COLOR=#990000 ];[/color]
[tab]
[tab][COLOR=#009900 ]$mydir[/color] [COLOR=#990000 ]=[/color] MYDIR[COLOR=#990000 ];[/color]
[tab][COLOR=#009900 ]$dir[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]opendir[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$mydir[/color][COLOR=#990000 ]);[/color]
[tab]
[tab][i][COLOR=#9A1900 ]//must escape $DBFilename to prevent sql injection[/color][/i]
[tab][COLOR=#009900 ]$sql[/color] [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]"select filename from $table where filename='"[/color][COLOR=#990000 ].[/color][b][COLOR=#000000 ]mysql_real_escape_string[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$DBFilename[/color][COLOR=#990000 ]).[/color][COLOR=#FF0000 ]"'"[/color][COLOR=#990000 ];[/color]
[tab]
[tab][COLOR=#009900 ]$getfilename[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]mysql_query[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$sql[/color][COLOR=#990000 ]);[/color]
[tab][b][COLOR=#0000FF ]if[/color][/b][COLOR=#990000 ](![/color][COLOR=#009900 ]$getfilename[/color][COLOR=#990000 ])[/color] [b][COLOR=#0000FF ]return[/color][/b] false[COLOR=#990000 ];[/color]
[tab]
[tab][b][COLOR=#0000FF ]while[/color][/b] [COLOR=#990000 ]([/color][COLOR=#009900 ]$row[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]mysql_fetch_array[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$getfilename[/color][COLOR=#990000 ]))[/color] [COLOR=#FF0000 ]{[/color]
[tab][tab][COLOR=#009900 ]$filename[/color] [COLOR=#990000 ]=[/color] [COLOR=#009900 ]$row[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'filename'[/color][COLOR=#990000 ]];[/color]
[tab][tab][COLOR=#009900 ]$result[/color] [COLOR=#990000 ].=[/color] [COLOR=#FF0000 ]'<tr><td><a href="'[/color][COLOR=#990000 ].[/color][b][COLOR=#000000 ]basename[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$mydir[/color][COLOR=#990000 ]).[/color][COLOR=#FF0000 ]'/'[/color][COLOR=#990000 ].[/color][COLOR=#009900 ]$filename[/color][COLOR=#990000 ].[/color][COLOR=#FF0000 ]'" target="_blank">'[/color][COLOR=#990000 ].[/color][COLOR=#009900 ]$filename[/color][COLOR=#990000 ].[/color][COLOR=#FF0000 ]'</a></td></tr>'[/color][COLOR=#990000 ];[/color]
[tab][COLOR=#FF0000 ]}[/color]
[tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color][COLOR=#009900 ]$result[/color][COLOR=#990000 ])[/color] [COLOR=#FF0000 ]{[/color]
[tab][tab][COLOR=#009900 ]$result[/color] [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]"<table><tbody><tr><td>Search Results.</td></tr> $result</table>"[/color][COLOR=#990000 ];[/color]
[tab][COLOR=#FF0000 ]}[/color]
[tab][b][COLOR=#0000FF ]return[/color][/b] [COLOR=#009900 ]$result[/color][COLOR=#990000 ];[/color]
[COLOR=#FF0000 ]}[/color]
[i][COLOR=#9A1900 ]//create a function to retrieve the files names[/color][/i]
[b][COLOR=#0000FF ]function[/color][/b] [b][COLOR=#000000 ]getFileNames[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$table[/color][COLOR=#990000 ])[/color][COLOR=#FF0000 ]{[/color]
[tab][COLOR=#009900 ]$options[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]array[/color][/b][COLOR=#990000 ]();[/color]
[tab][COLOR=#009900 ]$sql[/color][COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"select distinct filename from $table"[/color][COLOR=#990000 ];[/color]
[tab][COLOR=#009900 ]$result[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]mysql_query[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$sql[/color][COLOR=#990000 ]);[/color]
[tab][b][COLOR=#0000FF ]if[/color][/b][COLOR=#990000 ](![/color][COLOR=#009900 ]$result[/color][COLOR=#990000 ])[/color] [b][COLOR=#0000FF ]return[/color][/b] false[COLOR=#990000 ];[/color]
[tab][b][COLOR=#0000FF ]while[/color][/b] [COLOR=#990000 ]([/color][COLOR=#009900 ]$row[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]mysql_fetch_array[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$result[/color][COLOR=#990000 ])):[/color]
[tab][tab][COLOR=#009900 ]$options[/color][COLOR=#990000 ][][/color] [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]array[/color][/b][COLOR=#990000 ]([/color] [COLOR=#FF0000 ]'text'[/color][COLOR=#990000 ]=>[/color][COLOR=#009900 ]$row[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'filename'[/color][COLOR=#990000 ]],[/color]
[tab][tab][tab][tab][tab][tab][tab][COLOR=#FF0000 ]'value'[/color][COLOR=#990000 ]=>[/color][COLOR=#009900 ]$row[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'filename'[/color][COLOR=#990000 ]]);[/color]
[tab][b][COLOR=#0000FF ]endwhile[/color][/b][COLOR=#990000 ];[/color]
[tab][b][COLOR=#0000FF ]return[/color][/b] [COLOR=#009900 ]$options[/color][COLOR=#990000 ];[/color] 
[COLOR=#FF0000 ]}[/color]
[b][COLOR=#0000FF ]function[/color][/b] [b][COLOR=#000000 ]isAjax[/color][/b][COLOR=#990000 ]()[/color][COLOR=#FF0000 ]{[/color]
[tab][b][COLOR=#0000FF ]return[/color][/b] [b][COLOR=#0000FF ]isset[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_REQUEST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'a'[/color][COLOR=#990000 ]])[/color] [COLOR=#990000 ]&&[/color] [COLOR=#009900 ]$_REQUEST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'a'[/color][COLOR=#990000 ]][/color] [COLOR=#990000 ]==[/color] [COLOR=#993399 ]1[/color][COLOR=#990000 ];[/color]
[COLOR=#FF0000 ]}[/color]
[b][COLOR=#0000FF ]if[/color][/b][COLOR=#990000 ]([/color][b][COLOR=#0000FF ]isset[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_REQUEST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'action'[/color][COLOR=#990000 ]])):[/color]
[tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color][b][COLOR=#000000 ]isAjax[/color][/b][COLOR=#990000 ]()):[/color]
[tab][b][COLOR=#0000FF ]switch[/color][/b] [COLOR=#990000 ]([/color][COLOR=#009900 ]$_REQUEST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'action'[/color][COLOR=#990000 ]]):[/color]
[tab][tab][b][COLOR=#0000FF ]case[/color][/b] [COLOR=#FF0000 ]'getFileNames'[/color][COLOR=#990000 ]:[/color]
[tab][tab][tab][COLOR=#009900 ]$table[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]trim[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_GET[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'q'[/color][COLOR=#990000 ]]);[/color]
[tab][tab][tab][COLOR=#009900 ]$options[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]getFileNames[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$table[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$options[/color] [COLOR=#990000 ]===[/color] false[COLOR=#990000 ]):[/color]
[tab][tab][tab][tab][COLOR=#009900 ]$return[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]array[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'result'[/color][COLOR=#990000 ]=>[/color]false[COLOR=#990000 ]);[/color]
[tab][tab][tab][b][COLOR=#0000FF ]else[/color][/b][COLOR=#990000 ]:[/color]
[tab][tab][tab][tab][COLOR=#009900 ]$return[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]array[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'result'[/color][COLOR=#990000 ]=>[/color]true[COLOR=#990000 ],[/color] [COLOR=#FF0000 ]'options'[/color][COLOR=#990000 ]=>[/color][COLOR=#009900 ]$options[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][b][COLOR=#0000FF ]endif[/color][/b][COLOR=#990000 ];[/color]
[tab][tab][tab][b][COLOR=#0000FF ]echo[/color][/b] [b][COLOR=#000000 ]json_encode[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$return[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][b][COLOR=#0000FF ]die[/color][/b][COLOR=#990000 ];[/color] [i][COLOR=#9A1900 ]//should always expressly kill the process with ajax calls[/color][/i]
[tab][tab][b][COLOR=#0000FF ]break[/color][/b][COLOR=#990000 ];[/color]
[tab][tab]
[tab][tab][b][COLOR=#0000FF ]case[/color][/b] [COLOR=#FF0000 ]'getFileList'[/color][COLOR=#990000 ]:[/color]
[tab][tab][tab][COLOR=#009900 ]$table[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]trim[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_GET[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'table'[/color][COLOR=#990000 ]]);[/color]
[tab][tab][tab][COLOR=#009900 ]$filename[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]trim[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_GET[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'filename'[/color][COLOR=#990000 ]]);[/color]
[tab][tab][tab][COLOR=#009900 ]$data[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]doFileSearch[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$table[/color][COLOR=#990000 ],[/color] [COLOR=#009900 ]$filename[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$data[/color] [COLOR=#990000 ]===[/color] false[COLOR=#990000 ]):[/color]
[tab][tab][tab][tab][COLOR=#009900 ]$return[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]array[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'result'[/color][COLOR=#990000 ]=>[/color]false[COLOR=#990000 ],[/color] [COLOR=#FF0000 ]'error'[/color][COLOR=#990000 ]=>[/color][b][COLOR=#000000 ]mysql_error[/color][/b][COLOR=#990000 ]());[/color]
[tab][tab][tab][b][COLOR=#0000FF ]else[/color][/b][COLOR=#990000 ]:[/color]
[tab][tab][tab][tab][COLOR=#009900 ]$return[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]array[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'result'[/color][COLOR=#990000 ]=>[/color][COLOR=#FF0000 ]'ok'[/color][COLOR=#990000 ],[/color] [COLOR=#FF0000 ]'html'[/color][COLOR=#990000 ]=>[/color][COLOR=#009900 ]$data[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][b][COLOR=#0000FF ]endif[/color][/b][COLOR=#990000 ];[/color]
[tab][tab][tab][b][COLOR=#0000FF ]echo[/color][/b] [b][COLOR=#000000 ]json_encode[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$return[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][b][COLOR=#0000FF ]die[/color][/b][COLOR=#990000 ];[/color]
[tab][tab][b][COLOR=#0000FF ]break[/color][/b][COLOR=#990000 ];[/color]
[tab][tab]
[tab][tab][b][COLOR=#0000FF ]default[/color][/b][COLOR=#990000 ]:[/color]
[tab][tab][tab][b][COLOR=#0000FF ]echo[/color][/b] [b][COLOR=#000000 ]json_encode[/color][/b][COLOR=#990000 ]([/color][b][COLOR=#0000FF ]array[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'result'[/color][COLOR=#990000 ]=>[/color]false[COLOR=#990000 ]));[/color]
[tab][tab][tab][b][COLOR=#0000FF ]die[/color][/b][COLOR=#990000 ];[/color]
[tab][b][COLOR=#0000FF ]endswitch[/color][/b][COLOR=#990000 ];[/color]
[tab][b][COLOR=#0000FF ]else[/color][/b][COLOR=#990000 ]:[/color]
[tab][tab][b][COLOR=#0000FF ]if[/color][/b][COLOR=#990000 ]([/color][b][COLOR=#0000FF ]isset[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$_POST[/color][COLOR=#990000 ][[/color][COLOR=#FF0000 ]'submit'[/color][COLOR=#990000 ]])):[/color]
[tab][tab][tab][i][COLOR=#9A1900 ]//not an ajax call[/color][/i]
[tab][tab][tab][b][COLOR=#0000FF ]list[/color][/b][COLOR=#990000 ]([/color][COLOR=#009900 ]$searchcontent[/color][COLOR=#990000 ],[/color] [COLOR=#009900 ]$err[/color][COLOR=#990000 ])[/color] [COLOR=#990000 ]=[/color] [b][COLOR=#000000 ]check_search[/color][/b][COLOR=#990000 ]();[/color]
[tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color][COLOR=#009900 ]$err[/color][COLOR=#990000 ])[/color] [COLOR=#990000 ]:[/color]
[tab][tab][tab][tab][b][COLOR=#0000FF ]echo[/color][/b] [COLOR=#FF0000 ]"<p style=\"font-weight:bold;color:#ff0000;\">$err</p>"[/color][COLOR=#990000 ];[/color]
[tab][tab][tab][b][COLOR=#0000FF ]endif[/color][/b][COLOR=#990000 ];[/color][tab][tab]  
[tab][tab][b][COLOR=#0000FF ]endif[/color][/b][COLOR=#990000 ];[/color]
[tab][b][COLOR=#0000FF ]endif[/color][/b][COLOR=#990000 ];[/color]
[b][COLOR=#0000FF ]endif[/color][/b][COLOR=#990000 ];[/color]




[COLOR=#990000 ]?>[/color]
[COLOR=#990000 ]<![/color]DOCTYPE html PUBLIC [COLOR=#FF0000 ]"-//W3C//DTD XHTML 1.0 Transitional//EN"[/color] [COLOR=#FF0000 ]"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[/URL][/color][COLOR=#990000 ]>[/color]
[COLOR=#990000 ]<[/color]html[COLOR=#990000 ]>[/color]
[tab][COLOR=#990000 ]<[/color]head[COLOR=#990000 ]>[/color]
[tab][tab][COLOR=#990000 ]<[/color]title[COLOR=#990000 ]>[/color]PROTOTYPE[COLOR=#990000 ]</[/color]title[COLOR=#990000 ]>[/color]
[tab][tab][COLOR=#990000 ]<[/color]script type[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"text/javascript"[/color][COLOR=#990000 ]>[/color]
[tab][tab][tab][b][COLOR=#0000FF ]var[/color][/b] table [COLOR=#990000 ]=[/color] [COLOR=#FF0000 ]''[/color][COLOR=#990000 ];[/color]
[tab][tab][tab][b][COLOR=#0000FF ]function[/color][/b] [b][COLOR=#000000 ]getFiles[/color][/b][COLOR=#990000 ]([/color]elem[COLOR=#990000 ])[/color][COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color]window[COLOR=#990000 ].[/color]XMLHttpRequest[COLOR=#990000 ])[/color] [COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab]xmlhttp [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]new[/color][/b] [b][COLOR=#000000 ]XMLHttpRequest[/color][/b][COLOR=#990000 ]();[/color]
[tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab][b][COLOR=#0000FF ]else[/color][/b] [COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab]xmlhttp [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]new[/color][/b] [b][COLOR=#000000 ]ActiveXObject[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]"Microsoft.XMLHTTP"[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab]xmlhttp[COLOR=#990000 ].[/color]onreadystatechange [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]function[/color][/b][COLOR=#990000 ]()[/color][COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color]xmlhttp[COLOR=#990000 ].[/color]readyState [COLOR=#990000 ]==[/color] [COLOR=#993399 ]4[/color] [COLOR=#990000 ]&&[/color] xmlhttp[COLOR=#990000 ].[/color]status [COLOR=#990000 ]==[/color] [COLOR=#993399 ]200[/color][COLOR=#990000 ])[/color] [COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]var[/color][/b] d [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]eval[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'('[/color] [COLOR=#990000 ]+[/color] xmlhttp[COLOR=#990000 ].[/color]responseText [COLOR=#990000 ]+[/color] [COLOR=#FF0000 ]')'[/color][COLOR=#990000 ])[/color]
[tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color]d[COLOR=#990000 ].[/color]result [COLOR=#990000 ]==[/color] false[COLOR=#990000 ])[/color] [b][COLOR=#0000FF ]return[/color][/b][COLOR=#990000 ];[/color]

[tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]var[/color][/b] _elem [COLOR=#990000 ]=[/color] document[COLOR=#990000 ].[/color][b][COLOR=#000000 ]getElementById[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]"files"[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][tab][tab][tab]_elem[COLOR=#990000 ].[/color]innerHTML [COLOR=#990000 ]=[/color] d[COLOR=#990000 ].[/color]html[COLOR=#990000 ];[/color]
[tab][tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab]
[tab][tab][tab][tab][i][COLOR=#9A1900 ]//this is how you obtain the value of a selected option[/color][/i]
[tab][tab][tab][tab][b][COLOR=#0000FF ]var[/color][/b] val [COLOR=#990000 ]=[/color] elem[COLOR=#990000 ][[/color]elem[COLOR=#990000 ].[/color]selectedIndex[COLOR=#990000 ]].[/color]value[COLOR=#990000 ];[/color]
[tab][tab][tab][tab]
[tab][tab][tab][tab]
[tab][tab][tab][tab]xmlhttp[COLOR=#990000 ].[/color][b][COLOR=#000000 ]open[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]"GET"[/color][COLOR=#990000 ],[/color] [COLOR=#FF0000 ]"?action=getFileList&a=1&table="[/color] [COLOR=#990000 ]+[/color] [b][COLOR=#000000 ]encodeURIComponent[/color][/b][COLOR=#990000 ]([/color]table[COLOR=#990000 ])[/color] [COLOR=#990000 ]+[/color] [COLOR=#FF0000 ]"&filename="[/color] [COLOR=#990000 ]+[/color] [b][COLOR=#000000 ]encodeURIComponent[/color][/b][COLOR=#990000 ]([/color]val[COLOR=#990000 ]),[/color] true[COLOR=#990000 ]);[/color]
[tab][tab][tab][tab]xmlhttp[COLOR=#990000 ].[/color][b][COLOR=#000000 ]send[/color][/b][COLOR=#990000 ]();[/color]
[tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][b][COLOR=#0000FF ]function[/color][/b] [b][COLOR=#000000 ]showTable[/color][/b][COLOR=#990000 ]([/color]elem[COLOR=#990000 ])[/color][COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color]window[COLOR=#990000 ].[/color]XMLHttpRequest[COLOR=#990000 ])[/color] [COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab]xmlhttp [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]new[/color][/b] [b][COLOR=#000000 ]XMLHttpRequest[/color][/b][COLOR=#990000 ]();[/color]
[tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab][b][COLOR=#0000FF ]else[/color][/b] [COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab]xmlhttp [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]new[/color][/b] [b][COLOR=#000000 ]ActiveXObject[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]"Microsoft.XMLHTTP"[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab]xmlhttp[COLOR=#990000 ].[/color]onreadystatechange [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]function[/color][/b][COLOR=#990000 ]()[/color][COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color]xmlhttp[COLOR=#990000 ].[/color]readyState [COLOR=#990000 ]==[/color] [COLOR=#993399 ]4[/color] [COLOR=#990000 ]&&[/color] xmlhttp[COLOR=#990000 ].[/color]status [COLOR=#990000 ]==[/color] [COLOR=#993399 ]200[/color][COLOR=#990000 ])[/color] [COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]var[/color][/b] d [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]eval[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'('[/color] [COLOR=#990000 ]+[/color] xmlhttp[COLOR=#990000 ].[/color]responseText [COLOR=#990000 ]+[/color] [COLOR=#FF0000 ]')'[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color]d[COLOR=#990000 ].[/color]result [COLOR=#990000 ]==[/color] false[COLOR=#990000 ])[/color] [b][COLOR=#0000FF ]return[/color][/b][COLOR=#990000 ];[/color]
[tab][tab][tab][tab][tab][tab]
[tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]var[/color][/b] elem [COLOR=#990000 ]=[/color] document[COLOR=#990000 ].[/color][b][COLOR=#000000 ]getElementById[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]"DBFilename"[/color][COLOR=#990000 ]);[/color]
[tab][tab][tab][tab][tab][tab][i][COLOR=#9A1900 ]//remove all but the first option from the element[/color][/i]
[tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]for[/color][/b] [COLOR=#990000 ]([/color][b][COLOR=#0000FF ]var[/color][/b] i[COLOR=#990000 ]=[/color][COLOR=#993399 ]0[/color][COLOR=#990000 ];[/color] i [COLOR=#990000 ]<[/color] elem[COLOR=#990000 ].[/color]length[COLOR=#990000 ];[/color] i[COLOR=#990000 ]++)[/color][COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]if[/color][/b] [COLOR=#990000 ]([/color] i [COLOR=#990000 ]>[/color] [COLOR=#993399 ]0[/color][COLOR=#990000 ])[/color] elem[COLOR=#990000 ].[/color]options[COLOR=#990000 ][[/color]i[COLOR=#990000 ]][/color] [COLOR=#990000 ]=[/color] null[COLOR=#990000 ];[/color]
[tab][tab][tab][tab][tab][tab][COLOR=#FF0000 ]}[/color] 
[tab][tab][tab][tab][tab][tab]
[tab][tab][tab][tab][tab][tab][i][COLOR=#9A1900 ]//now add in the new options[/color][/i]
[tab][tab][tab][tab][tab][tab][b][COLOR=#0000FF ]for[/color][/b] [COLOR=#990000 ]([/color] [b][COLOR=#0000FF ]var[/color][/b] i[COLOR=#990000 ]=[/color][COLOR=#993399 ]0[/color][COLOR=#990000 ];[/color] i [COLOR=#990000 ]<[/color] d[COLOR=#990000 ].[/color]options[COLOR=#990000 ].[/color]length[COLOR=#990000 ];[/color] i[COLOR=#990000 ]++[/color] [COLOR=#990000 ])[/color][COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][tab][tab][tab]elem[COLOR=#990000 ].[/color]options[COLOR=#990000 ][[/color]elem[COLOR=#990000 ].[/color]length[COLOR=#990000 ]][/color] [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]new[/color][/b] [b][COLOR=#000000 ]Option[/color][/b][COLOR=#990000 ]([/color]d[COLOR=#990000 ].[/color]options[COLOR=#990000 ][[/color]i[COLOR=#990000 ]].[/color]text[COLOR=#990000 ],[/color] d[COLOR=#990000 ].[/color]options[COLOR=#990000 ][[/color]i[COLOR=#990000 ]].[/color]value[COLOR=#990000 ]);[/color]
[tab][tab][tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab][tab][tab]
[tab][tab][tab][tab][tab][tab][i][COLOR=#9A1900 ]//make the first item selected[/color][/i]
[tab][tab][tab][tab][tab][tab]elem[COLOR=#990000 ].[/color]selectedIndex [COLOR=#990000 ]=[/color] [COLOR=#993399 ]0[/color][COLOR=#990000 ];[/color] 
[tab][tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab][tab]
[tab][tab][tab][tab][i][COLOR=#9A1900 ]//this is how you obtain the value of a selected option[/color][/i]
[tab][tab][tab][tab][b][COLOR=#0000FF ]var[/color][/b] val [COLOR=#990000 ]=[/color] elem[COLOR=#990000 ][[/color]elem[COLOR=#990000 ].[/color]selectedIndex[COLOR=#990000 ]].[/color]value[COLOR=#990000 ];[/color]
[tab][tab][tab][tab]table [COLOR=#990000 ]=[/color] val[COLOR=#990000 ];[/color]
[tab][tab][tab][tab]
[tab][tab][tab][tab][i][COLOR=#9A1900 ]//add an action field[/color][/i]
[tab][tab][tab][tab]xmlhttp[COLOR=#990000 ].[/color][b][COLOR=#000000 ]open[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]"GET"[/color][COLOR=#990000 ],[/color] [COLOR=#FF0000 ]"?action=getFileNames&a=1&q="[/color] [COLOR=#990000 ]+[/color] [b][COLOR=#000000 ]encodeURIComponent[/color][/b][COLOR=#990000 ]([/color]val[COLOR=#990000 ]),[/color] true[COLOR=#990000 ]);[/color]
[tab][tab][tab][tab]xmlhttp[COLOR=#990000 ].[/color][b][COLOR=#000000 ]send[/color][/b][COLOR=#990000 ]();[/color]
[tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][tab]window[COLOR=#990000 ].[/color]onload [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]function[/color][/b][COLOR=#990000 ]()[/color][COLOR=#FF0000 ]{[/color]
[tab][tab][tab][tab][b][COLOR=#000000 ]showTable[/color][/b][COLOR=#990000 ]([/color]document[COLOR=#990000 ].[/color][b][COLOR=#000000 ]getElementById[/color][/b][COLOR=#990000 ]([/color][COLOR=#FF0000 ]'SrcTbl'[/color][COLOR=#990000 ]));[/color]
[tab][tab][tab][COLOR=#FF0000 ]}[/color]
[tab][tab][COLOR=#990000 ]</[/color]script[COLOR=#990000 ]>[/color]
[tab][COLOR=#990000 ]</[/color]head[COLOR=#990000 ]>[/color]
[tab][COLOR=#990000 ]<[/color]body[COLOR=#990000 ]>[/color]
[tab][tab][COLOR=#990000 ]<[/color]form method[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"post"[/color] action[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"<?php echo $_SERVER['PHP_SELF']; ?>"[/color] enctype[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"application/x-www-form-urlencoded"[/color][COLOR=#990000 ]>[/color]

[tab][tab][tab][COLOR=#990000 ]<[/color]fieldset[COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][COLOR=#990000 ]<[/color]label [b][COLOR=#0000FF ]for[/color][/b][COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"SrcTbl"[/color][COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][tab]Source Table 
[tab][tab][tab][tab][COLOR=#990000 ]</[/color]label[COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][COLOR=#990000 ]<[/color]select name[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"SrcTbl"[/color] id[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"SrcTbl"[/color] size[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"0"[/color] onchange[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"showTable(this);"[/color][COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][tab][COLOR=#990000 ]<[/color]option value[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]""[/color] selected[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"selected"[/color][COLOR=#990000 ]>[/color]Select Data Table[COLOR=#990000 ]</[/color]option[COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][tab][COLOR=#990000 ]<[/color]option value[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"MasterTable1"[/color][COLOR=#990000 ]>[/color]up to [COLOR=#993399 ]31[/color] days old[COLOR=#990000 ]</[/color]option[COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][tab][COLOR=#990000 ]<[/color]option value[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"MasterTable2"[/color][COLOR=#990000 ]>[/color][COLOR=#993399 ]62[/color] days old[COLOR=#990000 ]</[/color]option[COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][COLOR=#990000 ]</[/color]select[COLOR=#990000 ]>[/color]
[tab][tab][tab][COLOR=#990000 ]</[/color]fieldset[COLOR=#990000 ]>[/color]
[tab][tab][tab][COLOR=#990000 ]<[/color]fieldset id[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"filename"[/color] [COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][COLOR=#990000 ]<[/color]label [b][COLOR=#0000FF ]for[/color][/b][COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"DBFilename"[/color][COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][tab][b][COLOR=#000000 ]Filename[/color][/b] [COLOR=#990000 ]([/color]one item[COLOR=#990000 ])[/color]
[tab][tab][tab][tab][COLOR=#990000 ]</[/color]label[COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][COLOR=#990000 ]<[/color]select name[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"DBFilename"[/color] id[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"DBFilename"[/color] size[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"0"[/color] onchange[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"getFiles(this);"[/color][COLOR=#990000 ]>[/color]
[tab][tab][tab][tab][tab][COLOR=#990000 ]<[/color]option value[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]""[/color] selected[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"selected"[/color][COLOR=#990000 ]>[/color]Select Filename[COLOR=#990000 ]</[/color]option[COLOR=#990000 ]>[/color] 
[tab][tab][tab][tab][COLOR=#990000 ]</[/color]select[COLOR=#990000 ]>[/color]
[tab][tab][tab][COLOR=#990000 ]</[/color]fieldset[COLOR=#990000 ]>[/color]
[tab][tab][tab][COLOR=#990000 ]<[/color]input type[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"submit"[/color] name[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"submit"[/color] value[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"submit"[/color][COLOR=#990000 ]><[/color]input type[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"reset"[/color] value[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"Reset Form"[/color][COLOR=#990000 ]>[/color]
[tab][tab][tab][COLOR=#990000 ]<[/color]input type[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"hidden"[/color] name[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"action"[/color] value[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"getFileList"[/color] [COLOR=#990000 ]/>[/color]
[tab][tab][COLOR=#990000 ]</[/color]form[COLOR=#990000 ]>[/color]
[tab][tab][COLOR=#990000 ]<[/color]div id[COLOR=#990000 ]=[/color][COLOR=#FF0000 ]"files"[/color][COLOR=#990000 ]></[/color]div[COLOR=#990000 ]>[/color]
[tab][COLOR=#990000 ]</[/color]body[COLOR=#990000 ]>[/color]
[COLOR=#990000 ]</[/color]HTML[COLOR=#990000 ]>[/color]
 
oops. slight error there. replace the relevant bit of code with the following

Code:
[i][COLOR=#9A1900 ]//remove all but the first option from the element[/color][/i]
[b][COLOR=#0000FF ]for[/color][/b] [COLOR=#990000 ]([/color][b][COLOR=#0000FF ]var[/color][/b] i[COLOR=#990000 ]=[/color]elem[COLOR=#990000 ].[/color]length[COLOR=#990000 ]-[/color][COLOR=#993399 ]1[/color][COLOR=#990000 ];[/color] i [COLOR=#990000 ]>=[/color] [COLOR=#993399 ]1[/color][COLOR=#990000 ];[/color] i[COLOR=#990000 ]--)[/color][COLOR=#FF0000 ]{[/color]
[tab]elem[COLOR=#990000 ].[/color]options[COLOR=#990000 ][[/color]i[COLOR=#990000 ]][/color] [COLOR=#990000 ]=[/color] [b][COLOR=#0000FF ]null[/color][/b][COLOR=#990000 ];[/color]
[COLOR=#FF0000 ]}[/color]

for more help on the javascript nature of your query, check out the javascript forum.
 
Thanks for your help. I need to rework the whole flow of the app. Thanks for taking the time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top