PHP/MySQL Help

software development

#1

Hey guys,

I’m very much a novice when it comes to PHP, but I’m learning it and trying to implement it on my site. I’ve run into an issue that I hoping someone can help me to fix rather quickly.

I have a submission form which I am attempting to use. At the top of the page, you will notice the dropdown which I have managed to successfully populate with data from my SQL table. However, I have two problems.

First, I would like for the dropdown population to only represent the players in the team dropdown lower on the page. For example, if I select Boston from the teams dropdown, I only want players on Boston to appear in the top dropdown. I also am planning to move the top dropdown below the others but have yet to do so.

Second, I have the form setup to email the results to my server email using the recipient command; however, it is only submitting part of the information. Here is a copy of the line of code:

[quote] print “”;
$result = mysql_query(“SELECT P.last_name, P.first_name, P.position, T.name FROM players P, teams T WHERE P.experience=0 AND T.team_id=P.organization_id ORDER BY organization_id ASC, last_name ASC”) or die(mysql_error());;
while ($row = @mysql_fetch_array($result,MYSQL_ASSOC)) {
print “<option value=”.$row{‘last_name’}.", “.$row{‘first_name’}.”, “.$row{‘position’}.”-- “.$row{‘name’}.”>".$row{‘last_name’}.", “.$row{‘first_name’}.”, “.$row{‘position’}.”-- “.$row{‘name’}.”";
}
print “”;[/quote]
For whatever reason, the only thing getting to me via email is the last_name. I assume it is some form of syntax error, but I cannot figure out why I can’t receive the rest of the information such as first_name, position, and team.

Any help would be appreciated!


#2

try this

$result = mysql_query(“SELECT P.last_name [color=#CC0000]as lname[/color], P.first_name [color=#CC0000]as fname[/color], P.position [color=#CC0000]as pos[/color], T.name [color=#CC0000]as fullname[/color] FROM players P, teams T WHERE P.experience=0 AND T.team_id=P.organization_id ORDER BY organization_id ASC, last_name ASC”) or die(mysql_error());;
while ($row = @mysql_fetch_array($result,MYSQL_ASSOC)) {
print “<option value=”.$row{’[color=#CC0000]lname[/color]’}.", “.$row{’[color=#CC0000]fname[/color]’}.”, “.$row{’[color=#CC0000]pos[/color]’}.”-- “.$row{’[color=#CC0000]fullname[/color]’}.”>".$row{’[color=#CC0000]lname[/color]’}.", “.$row{’[color=#CC0000]fname[/color]’}.”, “.$row{’[color=#CC0000]pos[/color]’}.”-- “.$row{’[color=#CC0000]fullname[/color]’}.”";
}
print “”;

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here