I was wondering if I can get a little guidance, I am relativly new to php, I can do some scripting but still learning a lot of functions. Any ways what I am trying to do is, I am working on a fantasy hockey league site and the program, spits out all the rosters on one page with the rosters that has attributes, and the team etc, Link
I want to take that script that will allow it to be searchable, or sortable using php so you can sort by postion or age, or attribute value so I created a script, but when make the script I soon realized the because of the HTML code couldn't use file() and substr() to pull off a particular stat like speed, so I capy and pasted the page from a web browser to word and didn't have a problem.
The question I have is can I do it using LinkedRosters.html, in addition whats my option as far as adding functionality like multipul attribute searching example LW with OV 70 or sort by attribute,.
I just need some suggestions, of best way to do something like this if it is even possible. Also I think the I maybe able to get the rosters in Spread sheet form, can I use that?
Sample of php code I wrote
(it may be a little ineffective but remeber I am just learning)
<?php //player search results
print "<pre>";
$players=file('LinkedRosters.txt'); //gives $players array the
varible linkedrosters
$attribute=$_POST['attribute'];
$value=$_POST['value']; //varibles got off form
print "Attribute:" . $attribute . "<br/>";
print "Value:" . $value . "<br/>";
foreach ($players as $line_num => $line) //causes to loop through
each line of array
{
if($attribute == 'Position')//if attribut drop down
{
$team = substr($players[$line_num], 0,17);
$team = trim($team); //trims down to show team player is on
$val = substr($players[$line_num], 26,2);
$val = trim($val);
if (($team == 'Flyers')OR ($team == 'Devils') OR ($team == 'Islanders
') OR ($team == 'Rangers') OR ($team == ' Capitals') OR ($team ==
'Penguins') OR ($team == 'Bruins') OR ($team == 'Canadiens
') OR ($team == 'Nordiques') OR ($team == 'Sabres') OR ($team ==
'Whalers') OR ($team == 'NorthStars') OR ($team == 'Blues') OR ($team
== 'Leafs') OR ($team == 'Red Wings
') OR ($team == 'Blackhawks') OR ($team == 'Flames') OR ($team ==
'Oilers') OR ($team == 'Jets') OR
($team == 'Canucks') OR ($team == 'Kings') OR ($team == 'Sharks')
OR ($team == 'Senators') OR ($team == 'Lightning'))
{
print "<p><h2>" . $team . "</h2></p>";
print $players[8];
}
if($val == $value)
{
print $players[$line_num];
}
}
if($attribute == 'Intensity')
//it goes on to search for to repeat if statement for each attribute
Here the actual page: http://jeff.ninetieshockeyleague.com/player_search.php
sorry about the sloppnes but I had trouble with the copy paste.
Thanks is advance for some suggections or help you can also email me at j.bolton@gmail.com, I am not asking for the code just a gentle shove in the right direction or some advice for a beginner in scripting thanks jeff