Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Problem with dropdown value

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Problem with dropdown value

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

Good night,
i´m having a bit of trouble with a dropdown. I can´t get the selected value to pass to another page.
I´m using the method post 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 seems to be the problem? I don´t get it.
Some help needed !!!!

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

Re: Problem with dropdown value

Postby paintitblack » Mon Feb 17, 2014 9:09 pm

You say you're using the post method, but your form actually specifies get, so that's probably your problem.
paintitblack
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Feb 17, 2014 8:53 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

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