/    Sign up×
Community /Pin to ProfileBookmark

multi select and php

It must be something I cant see. It is driving me nuts.

I have these 2 values in a form

[code=php]
<select name=”existingPlayer[]” multiple=”true” >
<?php
$query = “edit”;
$results = querydatabase ($query);
while($row = mysql_fetch_assoc($results))
{
echo “<option value=””.$row[“player”].””>”.$row[“player”].”</option>”;
}
?>
</select>
<input type=”text” name=”player” size=”100″ maxlength=”100″ /></td>

[/code]

the form returns

[code]
[“existingPlayer”]=> string(12) “Aaron Rowand” [“player”]=> string(14) “fsfgdgdfgsgdsg”
[/code]

my code to read it is

[code=php]
$players = $_POST[“player”];
$playersTemp = $_POST[‘existingPlayer’];
var_dump(@playersTemp);
if ($playersTemp)
{
echo “<br />1<br />”;
foreach ($playersTemp as $player)
{
echo “<br />2<br />”;
$players = $player.”/”.$players;
}
}
[/code]

I am never getting to the 2 above.

What am I doing wrong? I have been looking at this for a while and something this simple shouldn’t be this problematic.

tia

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@GenixdeaeJan 13.2010 — I am never getting to the 2 above[/quote] which '2' are you referencing to? Are you referencing to the variables? or that it's not outputting the code, which I'm not sure if you're outputting this elsewhere but you don't echo $players = $player."/".$players;. Anyways, wanna clarify a little? Or you get it fixed?
Copy linkTweet thisAlerts:
@dk_zero-coolJan 13.2010 — You could try to put selected='selected' in all the options that you wish to parse along during the request.
×

Success!

Help @DARTHTAMPON spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...