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

Join 117,165 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 2,516 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 forms

 
Reply to this topicStart new topic

drop down forms, getting information from drop down menus

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


New D.I.C Head

*
Joined: 25 Mar, 2007
Posts: 3


My Contributions


[font=Arial]

<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";

this doesn't seem to work
User is offlineProfile CardPM

Go to the top of the page


level1
post 27 Jun, 2008 - 12:22 PM
Post #2


New D.I.C Head

*
Joined: 12 Jun, 2008
Posts: 34



Thanked 5 times
My Contributions


QUOTE

$testx = $_POST['playertoedit'];

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

this doesn't seem to work


Notice this is not php atm. You need to put it inside of <?php ?> tags. Once you do that you will see $testx echoes Array. To retrieve the values of your select you can do $testx[0], etc. Now, really this is not a good way to do things. You should remove the [] from the name of your select. So, your select should just be named playertoedit. Then you can retrieve the value they selected from $testx.

(i.e. just add the php tags and remove the [] from your select and you will be done)
User is offlineProfile CardPM

Go to the top of the page

merlinore
post 27 Jun, 2008 - 01:08 PM
Post #3


New D.I.C Head

*
Joined: 25 Mar, 2007
Posts: 3


My Contributions


Hi,
I don't quite understand?



$testx = $_POST['playertoedit'];

is the above to be changed to :

CODE

<?php  
$testx = playertoedit;

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


THis did not work - an example would help

Thanks
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/6/08 11:21AM

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