Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,485 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,225 people online right now. Registration is fast and FREE... Join Now!




drop down menus

 
Reply to this topicStart new topic

drop down menus, getting results from selection

merlinore
post 27 Jun, 2008 - 10:27 AM
Post #1


New D.I.C Head

*
Joined: 25 Mar, 2007
Posts: 3


My Contributions


Hi,

below is my code - I select a value and can't seem to display what I have selected.

THanks

CODE


<form method="post" action="<?php echo $PHP_SELF;?>">
<select name="playertoedit[]">
  <option value="0" <?php
  if (empty($playertoedit)) echo "selected";
?>>- select -</option>

<?php  
for ($ix=0; $ix<$ii; $ix++)
{    echo " <option value='$firstandlastnamearray[$ix]'";  
echo ">",$firstandlastnamearray[$ix],"</option>\n";
}?>

</select>
<br>
<input type="submit" value="submit" name="submit">
</form>

$testx = $_POST['playertoedit'];

/*This should say 'Array' */
echo "Skill sets posted as: .$testx";



User is offlineProfile CardPM

Go to the top of the page

joeyadms
post 27 Jun, 2008 - 11:06 AM
Post #2


D.I.C Head

Group Icon
Joined: 4 May, 2008
Posts: 145



Thanked 6 times

Dream Kudos: 600

Expert In: PHP, Web Security

My Contributions


Use foreach for iterating through arrays. Also PHP_SELF is unreliable, just use an empty string.

User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 03:33PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month