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

Join 117,527 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 1,959 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! 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 - 11: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 - 12:06 PM
Post #2


D.I.C Head

Group Icon
Joined: 4 May, 2008
Posts: 145



Thanked 6 times

Dream Kudos: 600
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: 10/7/08 03:57PM

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