Page 1 of 1

Simple problem

Posted: Fri Feb 05, 2010 5:36 am
by mariolopes
Ho have two grids and i want to click in one link for grid one and put some value in one input form, after i want to do the same with the other grid i.e put one value in other textbox. I can't do this because i loose one value when i get the other, i don't or i can't pass the two values at the same time. The values are passed with $_Get. Please look at the following code:

Code: Select all

 
echo "<form action=processaestagio.php method=post>";           
$Ida=$_GET[Ida];        
$Ide=$_GET[Ide];            
echo"Aluno: <input type=Text name=aluno value=$Ida /> </br>";
echo"Empresa: <input type=Text name=empresa value=$Ide />";
echo"<input type=Submit value=Cria/>";
echo"</form>";
 

Re: Simple problem

Posted: Fri Feb 05, 2010 5:45 am
by aravona
not sure it'll fix it but surely your HTML will be better with quotes?

Code: Select all

 
<form action='processaestagio.php' method='post'>                
<input type='Text' name='aluno' value='$Ida' /> 
<input type='Text' name='empresa' value='$Ide' />
<input type='Submit' value='Cria' />
</form>

Re: Simple problem

Posted: Fri Feb 05, 2010 6:04 am
by mariolopes
The problem is i loose one value when i set the other value.

Re: Simple problem

Posted: Fri Feb 05, 2010 6:14 am
by aravona
I assume what your sending through GET is small information? Less than 100 characters? Does it work if you post the infomation instead?

Re: Simple problem

Posted: Fri Feb 05, 2010 6:46 am
by mariolopes
I send the value Ida in the following form:
http://xxxx.com?Ida=56 and now i get the value in the text box.
I send the value Ide in the following form:
htpp://xxx.com?Ide=33 but when i put the value in text i loose the value of Ida, because there is no such parameter Ida I can pass only one value at time and when i get ine value i loose the other value.

Re: Simple problem

Posted: Fri Feb 05, 2010 7:36 am
by aravona
Post the code your sending with?

Re: Simple problem

Posted: Fri Feb 05, 2010 9:01 am
by mariolopes
The code is already posted in my first post

Re: Simple problem

Posted: Fri Feb 05, 2010 9:05 am
by aravona
I meant where your getting this information from:

$Ida=$_GET[Ida];
$Ide=$_GET[Ide];

Re: Simple problem

Posted: Fri Feb 05, 2010 9:58 am
by mariolopes
Here is my total code. Maybe i have to use session variables to store the first value, but i will try to avoid it.

Code: Select all

 
<?php
echo "<table border=1>";
    
    echo"<tr>";
        echo"<td>";//mostrar todos os alunos
            $mysql_id = mysql_connect('localhost', "xxx", "xxx");
            mysql_select_db('mariolopes',$mysql_id);
            $query="select * from alunos order by Nome ";
            $result=mysql_query($query);
    
            echo"<table border='2'>";
                echo"<tr>";
                echo "Dados dos alunos:";
                echo"</tr>";
                echo"<tr>";
                echo"<td></td>";
                echo"<td>Username</td>";                
                echo"<td>Nome</td>";                
                echo"</tr>";
                while($row=mysql_fetch_array($result)){
                echo "<tr>";
                echo "<td>";echo "<a href='criarestagio.php?Ida=";echo $row[Username];echo "'>Select</a>";echo "</td>";
                echo "<td>";echo $row['Username'];echo"</td>";
                echo "<td>";echo $row['Nome'];echo"</td>";
                echo"</tr>";
                }
            echo"</table>";                 
        echo"</td>";
        //---terminou o espaço dos alunos
        echo "<td>"; //começa o espaço empresa
        
            $mysql_id = mysql_connect('localhost', "xxx", "xxxx");
            mysql_select_db('mariolopes',$mysql_id);
            $query="select * from empresas order by Nome ";
            $result=mysql_query($query);
    
            echo"<table border='2'>";
                echo"<tr>";
                echo "Dados das Empresas:";
                echo"</tr>";
                echo"<tr>";
                echo"<td></td>";
                echo"<td>Username</td>";                
                echo"<td>Nome</td>";                
                echo"</tr>";
                while($row=mysql_fetch_array($result)){
                echo "<tr>";
                echo "<td>";echo "<a href='criarestagio.php?Ide=";echo $row[Username];echo "'>Select</a>";echo "</td>";
                echo "<td>";echo $row['Username'];echo"</td>";
                echo "<td>";echo $row['Nome'];echo"</td>";
                echo"</tr>";
                }
            echo"</table>";                 
        echo"</td>";
            
            //termina o espaço empresas
        echo "<td>"; //fazer estágio
            echo "<form action=processaestagio.php method=post>";           
            $Ida=$_GET[Ida];        
            $Ide=$_GET[Ide];            
            echo"Aluno: <input type=Text name=aluno value=$Ida /> </br>";
            echo"Empresa: <input type=Text name=empresa value=$Ide />";
            echo"<input type=Submit value=Cria/>";
            echo"</form>";
            
        echo "</td>";
    echo"</tr>";
echo "</table>";
?>