Skip to content

Instantly share code, notes, and snippets.

@lfzawacki
Created December 3, 2012 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfzawacki/4199092 to your computer and use it in GitHub Desktop.
Save lfzawacki/4199092 to your computer and use it in GitHub Desktop.
PHP STUFF
<?php
$sql0 = mysql_query("SELECT DISTINCT nomecliente FROM andamento ORDER BY nomecliente") or die ("Erro: ".mysql_error());
$list_options = "";
while ($aux0 = mysql_fetch_array($sql0)) {
$nome = $aux0["nomecliente"];
/* Cria uma string com as options de todos clientes, coloca um depois do outro */
$list_options .= "<option value='$nome'>$nome</option>\n";
/* Fica tipo
<option value='lucas'>lucas</option>
<option value='rael'>rael</option>
...
*/
?>
<select name="nomecliente" id="nomecliente">
<option selected="selected" value="<? echo $nomecliente; ?>"><? echo $nomecliente; ?></option>
<?php
/* aqui para cada cliente imprime a lista inteira, que foi feita ANTES*/
echo($list_options)
?>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment