PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mariolopes
Forum Contributor
Posts: 102 Joined: Sun May 22, 2005 7:08 am
Post
by mariolopes » Fri Feb 05, 2010 5:36 am
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>";
aravona
Forum Contributor
Posts: 347 Joined: Sat Jun 13, 2009 3:59 pm
Location: England
Post
by aravona » Fri Feb 05, 2010 5:45 am
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>
mariolopes
Forum Contributor
Posts: 102 Joined: Sun May 22, 2005 7:08 am
Post
by mariolopes » Fri Feb 05, 2010 6:04 am
The problem is i loose one value when i set the other value.
aravona
Forum Contributor
Posts: 347 Joined: Sat Jun 13, 2009 3:59 pm
Location: England
Post
by aravona » Fri Feb 05, 2010 6:14 am
I assume what your sending through GET is small information? Less than 100 characters? Does it work if you post the infomation instead?
mariolopes
Forum Contributor
Posts: 102 Joined: Sun May 22, 2005 7:08 am
Post
by mariolopes » Fri Feb 05, 2010 6:46 am
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.
aravona
Forum Contributor
Posts: 347 Joined: Sat Jun 13, 2009 3:59 pm
Location: England
Post
by aravona » Fri Feb 05, 2010 7:36 am
Post the code your sending with?
mariolopes
Forum Contributor
Posts: 102 Joined: Sun May 22, 2005 7:08 am
Post
by mariolopes » Fri Feb 05, 2010 9:01 am
The code is already posted in my first post
aravona
Forum Contributor
Posts: 347 Joined: Sat Jun 13, 2009 3:59 pm
Location: England
Post
by aravona » Fri Feb 05, 2010 9:05 am
I meant where your getting this information from:
$Ida=$_GET[Ida];
$Ide=$_GET[Ide];
mariolopes
Forum Contributor
Posts: 102 Joined: Sun May 22, 2005 7:08 am
Post
by mariolopes » Fri Feb 05, 2010 9:58 am
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>";
?>