可能对你们来说很容易。我正在尝试对表单发送的$ _POST变量进行排序,并在mysql中更新排序后的结果。我不知道该怎么做,并感谢任何人都可以帮助我。
我main.php
//I have a loop here. (omitted)
//$k will be increased by 1 every time the loop starts, so I will know the total times of the loops
//the form will be submitted to update.php
echo "<input type='hidden' name='pickTotal' value='".$k."' />";
echo "<input type='hidden' id='point' name='earnedPoint".$k."' value='".$point."' />";
echo "<input type='hidden' id='users' name='userName".$k."' value='".$userPick['user']."' />";
//loop ends
我update.php
if(isset($_POST['submit'])){
$pickTotal=$_POST['pickTotal']; //get the total loop
for ($p=0;$p<=$pickTotal;$p++){
$userToBeUpdated=$_POST['userName'.$p];
$userPoint=$_POST['earnedPoint'.$p];
//sort the $userPoint here.
//I need to find out who got the most points
//and list user's place. 1st, 2nd, 3rd...etc.
//update my mysql
}
感谢您的任何帮助。
谢谢。 PHP特殊的表单名称语法非常有用。 – FlyingCat 2010-05-31 00:31:13
我会给你接受的答案,因为你是第一个调出php名称语法的人。 :D – FlyingCat 2010-05-31 00:40:36