switching Td's

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Neller
Forum Newbie
Posts: 18
Joined: Sun Mar 27, 2005 4:56 am

switching Td's

Post by Neller »

Im trying to create a small football program and i was doing pretty well up untill this part here what im stuck on...

i have a team coming out of a database like so


<tr>
<td>Player name </td><td>Position</td><td>rating</td>
<td>Player name 2 </td><td>Position</td><td>rating</td>
<td>Player name 3 </td><td>Position</td><td>rating</td>
</tr>

well i need to be able to swap the players around when i click on there name like if i clicked on player 2 then on player 3 i need them to switch places in the table so..


<tr>
<td>Player name </td><td>Position</td><td>rating</td>
<td>Player name 3</td><td>Position</td><td>rating</td>
<td>Player name 2 </td><td>Position</td><td>rating</td>
</tr>

if anyone can help me i would be very gratefull as im totaly stuck
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

This would mostly involve Javascript to set maybe a couple of hidden fields and automatically submitting after two different items are selected.
Neller
Forum Newbie
Posts: 18
Joined: Sun Mar 27, 2005 4:56 am

Post by Neller »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


sorry not sure how that would work here is what the table looks like on the page

[syntax="html"]<table>
<tr>
<td>1</td> <td>Reina</td> <td>GK</td> <td></td>92<td> 100</td>
</tr> 
<tr>
<td>2</td> <td>Finnan</td> <td>RB</td> <td></td>89<td> 100</td>
</tr> 
<tr>
<td>3</td> <td>Risse</td> <td>LB</td> <td></td>91<td> 100</td>
</tr> 
<tr>
<td>4</td> <td>Caragher</td> <td>CB</td> <td></td>94<td> 100</td>
</tr> 
<tr>
<td>5</td> <td>Hyypia</td> <td>CB</td> <td></td>88<td> 100</td>
</tr> 
<tr>
<td>6</td> <td>Gerrard</td> <td>RM</td> <td></td>97<td> 100</td>
</tr> 
<tr>
<td>7</td> <td>Sissoko</td> <td>CM</td> <td></td>91<td> 100</td>
</tr> 
<tr>
<td>8</td> <td>Alonso</td> <td>CM</td> <td></td>95<td> 100</td>
</tr> 
<tr>
<td>9</td> <td>Kewell</td> <td>LM</td> <td></td>90<td> 100</td>
</tr> 
<tr>
<td>10</td> <td>Crouch</td> <td>CF</td> <td></td>90<td> 100</td>
</tr> 
<tr>
<td>11</td> <td>Fowler</td> <td>ST</td> <td></td>89<td> 100</td>
</tr> 
</table>


well the numbers will never move but say i wanted to but Fowler to number 10 with his rating (89) and his condition (100) i need to be able to switch them around by clicking on them

sorry if im not explaining it very well im new to this


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply