xhpotterx Posted April 11, 2013 at 04:28 PM Report #502840 Posted April 11, 2013 at 04:28 PM Boas pessoal tenho uma combobox com dados de uma bd. Como posso saber qual o "texto" que selecionei na combobox? Quero que ele me devolva o numero da linha que selecionei Tipo uma especie de Selec Index.
Solution pikax Posted April 11, 2013 at 04:36 PM Solution Report #502842 Posted April 11, 2013 at 04:36 PM (edited) form.php <?php $sql = "SELECT ID, UserName FROM users"; //....query... e form ?> <select name="user"> <?php while($row = *_fetch_array($query)) { ?> <option value="<?=$row["ID"]?>"><?=$row["UserName"]?></option> <?php } ?> </select> <?php //..... trataInfo.php $optionID = $_POST["user"]; echo $optionID; EDIT: BTW *_fetch_array($query) e' para substituir o * por mysqli, ou isso... e falta o resto do codigo... Edited April 11, 2013 at 04:50 PM by pikax Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender. A beleza de um código está em decompor problemas complexos em pequenos blocos simples. "learn how to do it manually first, then use the wizzy tool to save time." "Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."
xhpotterx Posted April 12, 2013 at 10:41 AM Author Report #502927 Posted April 12, 2013 at 10:41 AM Tópico Resolvido.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now