General discussions related to php

Moderators: macek, egami, gesf

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


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>

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


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: No registered users and 7 guests