Dropdowns

General discussions related to php

Moderators: macek, egami, gesf

torsuntsu
New php-forum User
New php-forum User
Posts: 2
Joined: Thu Oct 24, 2013 12:42 pm

Dropdowns

Postby torsuntsu » Thu Oct 24, 2013 1:20 pm

I´m having a bit of trouble with dropdowns. I can´t pass the selected value to another page.
I´m using the post method, but i get nothing.
Here is a bit of the code:
echo '<form action="permissions.php" method="get" id="form">
<table><tr><td>Seleccionar Utilizador:</td><td><select name="utilizadores" id="utilizadores">';
$query = mysql_query("SELECT * FROM `users`");
while(($row = mysql_fetch_array($query))!== false)
{
echo '<option value="'.$row["id"].'">'.$row["first_name"].' '.$row["last_name"].'</option>';
}
echo '</select></td>
</tr>
</table>


On the page permissions.php i have this code:
<?php $teste= $_POST['utilizadores'];
echo $teste;
?>

But i get nothing in the variable $teste.
What is the problem?
Some help would be great...

Thanks,
TorSunTsu

MarioParty
New php-forum User
New php-forum User
Posts: 42
Joined: Tue Aug 02, 2011 2:52 am

Re: Dropdowns

Postby MarioParty » Sat Nov 16, 2013 3:24 am

Your form method is GET, but you are checking the POST variable. Change one of them.


Return to “PHP General”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron