Problem with dropdown value

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

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>

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 !!!!


New php-forum User
New php-forum User
Posts: 8
Joined: Mon Feb 17, 2014 8:53 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.

Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 6 guests