Returning more than one variable in JQuery / PHP

1

Being objective, my problem is this:

I have a form in PHP / HTML and I'm using a field auto-fill via Jquery. This form brings up the last numbers wagered by the user and remakes the wager with this numbers automatically without it needing to type all over again.

So I have two files:

1) Form where the user selects the draw that wishes to repeat the bet

2) Page in .php that receives the request from the form according to the lottery chosen by the user, filters and returns the numbers of that lottery chosen for the form.

In case of file 02, when pulling with the file in isolation, ie opening it in the browser, it returns me the correct value of that user's numbers corresponding to the chosen draw, however when trying to select the draw in file 01 it does not pull and fills in the data ... So my doubt lives, what could be wrong?

Let's go to the codes:

File 01:

        <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
    <script type="text/javascript">
        function numeroConcurso(id){
                $.post("paginas/repetiraposta.php",{idConcurso:id},function(retorno){
                    dados = retorno.split("/");
                    $('#num01').val(dados[0]);
                    $('#num02').val(dados[1]);
                    $('#num03').val(dados[2]);
                    $('#num04').val(dados[3]);
                    $('#num05').val(dados[4]);
                    $('#num06').val(dados[5]);
                    $('#num07').val(dados[6]);
                    $('#num08').val(dados[7]);
                    $('#num09').val(dados[8]);
                    $('#num10').val(dados[9]);
                    $('#num11').val(dados[10]);
                    $('#num12').val(dados[11]);
                    $('#num13').val(dados[12]);
                    $('#num14').val(dados[13]);
                    $('#num15').val(dados[14]);
                    });
            }
    </script>

<!--FORMULÁRIO-->

<label>Repetir aposta do concurso:[EM DESENVOLVIMENTO]</label>
    <select name="concurso" onchange="numeroConcurso(this.value)">
        <option value="">Escolha um concurso</option>
            <?php 
                $sql2 = mysql_query("SELECT * FROM numeros WHERE usuario='$usuario'");
                while($sorteio_atual = mysql_fetch_object($sql2)){
                echo "
                <option value='$sorteio_atual->sorteio'>
                        $sorteio_atual->sorteio</option>
                ";
                }
            ?>
    </select>

File 02:

$usuario1 = $_SESSION['usuario'];
$id = $_POST['idConcurso'];
$sqlConcurso = mysql_query("SELECT * FROM numeros WHERE usuario='$usuario1'");
$concurso = mysql_fetch_object($sqlConcurso);
$dados = $concurso->numero01."/".$concurso->numero02."/".$concurso->numero03."/".$concurso->numero04."/".$concurso->numero05."/".$concurso->numero06."/".$concurso->numero07."/".$concurso->numero08."/".$concurso->numero09."/".$concurso->numero10."/".$concurso->numero11."/".$concurso->numero12."/".$concurso->numero13."/".$concurso->numero14."/".$concurso->numero15."/".$concurso->usuario;
    echo $dados;

So that's it:

I want the guy to select the draw, the numbers corresponding to the code return on the form automatically for him to remake his bet!

Note: If I change the 02 file to:

$sqlConcurso = mysql_query("SELECT * FROM numeros WHERE usuario='$usuario1'");

Form 01 returns the numbers of all unfiltered players by the user name.

Filter control is being performed on the function: $_SESSION['usuario']

If necessary, the code example is on the site:

loteriamxt.tk

"Bet!" tab.

Thank you all for your attention!

The code inside the file 02 was thus:

session_start(); 

$usuario1 = $_SESSION['usuario']; 

$id = $_POST['idConcurso']; $sqlConcurso = mysql_query("SELECT * FROM numeros WHERE sorteio='$id' AND usuario='$usuario1'"); 

Filtering by user and selected lot number on the form! Thank you very much Anderson Carlos Woss!

    
asked by anonymous 19.02.2017 / 00:29

1 answer

-1

The code inside the file 02 was thus:

session_start(); 

$usuario1 = $_SESSION['usuario']; 

$id = $_POST['idConcurso']; $sqlConcurso = mysql_query("SELECT * FROM numeros WHERE sorteio='$id' AND usuario='$usuario1'");

Filtering by user and selected lot number on the form! Thank you Anderson Carlos Woss!

    
19.02.2017 / 01:23