phprookie72
-
Posts
16 -
Joined
-
Last visited
Posts posted by phprookie72
-
-
array_rand function select 2 random elements from an array, is it possible to tell the function not to select a certain elements?
-
would like to know how i can tell array_rand not to select a specific elements from an array?
-
thank you floor() will do what i want.
-
is there a math function that give you an integer value when u divide 2 numbers?
ie in 7/3 i just want 2 as a result not floating number.
thanks in advance.
-
is there a function that allows me to remove element in an array?
when i know the key element of the array i want to remove, thank you.
-
i am trying to write a form in drupal, here is my plan. I have a database of players name and number, I would like to write a form that allows user to change players number, my question is how would i create a form that display values from the database? The initial form would be players name (title) on left side (name are taken from database) and players number (textfield) on right side with default value from database.
I guess my question is how do you display dynamic values in drupal form, instead of hard codeing?
-
ok I finally got it , dam quotes
thank you everyone for your help
-
this is my form
if(mysql_num_rows($result)>0)
{
$output= "<form action='' method= 'post'><table>";
while($row= mysql_fetch_array($result))
{
$output .= "<tr><td>$row[name]</td>";
$output .= "<td><input type=text name=playername" . "[$row[name]]" . " value= $row[number]></td></tr>";
}
$output .= '<tr><td colspan=2><input type=submit name=editplayers value=Submit </td></tr>';
$output .= '</table>';
$output .= '</form>';
}
else
$output .= 'no record found';
echo $output;
}
if(isset($_POST['editplayers']))
{$arrayname= $_POST['playername'];
var_dump($arrayname);
}
-
ok its assign values corectly to name=playername['john doe'] , name=playername['steve smith'] and so on in the form input properties.
how do i get this array after the user click the submit buttom
i tried var_dump($_POST['playername']);
but get NULL as result.
-
still not getting anything
-
yes form use POST method.
-
how come I get NULL from this statement after the user click the submit button
var_dump($_POST['playername']);
-
here's what i am trying to accomplish, I would get array of name from my db and run a loop to create my form for ie.
while($row=mysql_fetch_array($result))
{
echo '<input type=text name=' . playername[$row['name']] . ' value=' . $row['playernumber']></input>';
}
is this possible?
when i use playername[] it works but i get 0,1,2 for index but i would like to use keys as my index.
-
sweet thank you
-
I have an array as follow
$data=array('team1'=>array('w'=>0,'l'=>1,'t'=>0,'pts'=>0', team2'=>array('w'=>1,'l'=>0,'t'=>0,'pts'=>3), 'team3'=>array('w'=>0,'l'=>0,'t'=>1,'pts'=>1) )
I would like to sort the data useing pts key in descending order, how would i go about doing that?
thanks.
Match Schedule Algorithm
in PHP Coding Help
Posted
hi, i am trying to figure create a match schedule app using php.
i have read the round robin tournament from this link http://en.wikipedia.org/wiki/Round-robin_tournament
I know how to this work but how would you solve the problem if more then one team/player gets a bye week?