Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Dropdowns

General discussions related to php

Moderators: macek, egami, gesf

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
torsuntsu
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Oct 24, 2013 12:42 pm

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.
MarioParty
New php-forum User
New php-forum User
 
Posts: 42
Joined: Tue Aug 02, 2011 2:52 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.