Jump to content

Php/XHTML problem with hiscores (help please)


rswildy

Recommended Posts

moved it up a directory now im getting errors http://runescape.rswildy.co.uk/AFprsfs/hiscores.phpCurrent code is:

<?phpini_set("display_errors", 1);error_reporting(E_ALL);?><form action="hiscores.php" method="get" target="_self">	<td style="border-right-width:0px; border-right-style:solid; border-right-color:#261F13; width:66%; background-color:#362D1A;"><center><input type="text" name="name" value="<?php echo $_GET['name']?>" /><br /><?php$contents = ""; $handle = fopen("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=". urlencode($_GET['name']),"r");if($handle){  while (!feof($handle))  {	$contents .= fread($handle, 8192);  }  fclose($handle);}function parse($skill_name){  global $contents;  $matches = array();  $pattern = "@<tr>\\s<td.*><img.*></td>\\s<td.*><a.*>\\s" . $skill_name . "\\s</a></td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s</tr>@imsU";  $match_found = preg_match($pattern, $contents, $matches);  $retval = array();  if ($match_found && $matches[1] != "")	$retval['rank'] = $matches[1];  else	$retval['rank'] = "--";  if ($match_found && $matches[2] != "")	$retval['level'] = $matches[2];  else	$retval['level'] = "--";  if ($match_found && $matches[3] != "")	$retval['xp'] = $matches[3];  else	$retval['xp'] = "--";  return $retval;}$info = parse("Attack");echo "Attack:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Defence");echo "Defence:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Strength");echo "Strength:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Hitpoints");echo "Hitpoints:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Ranged");echo "Ranged:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Prayer");echo "Prayer:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Magic");echo "Magic:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Cooking");echo "Cooking:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Woodcutting");echo "Woodcutting:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Fletching");echo "Fletching:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Fishing");echo "Fishing:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Firemaking");echo "Firemaking:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Crafting");echo "Crafting:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Smithing");echo "Smithing:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Mining");echo "Mining:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Herblore");echo "Herblore:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Agility");echo "Agility:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Thieving");echo "Thieving:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Slayer");echo "Slayer:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Farming");echo "Farming:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Runecraft");echo "Runecraft:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Hunter");echo "Hunter:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";echo "<br>";$info = parse("Construction");echo "Construction:<br>";echo "Rank: " . $info['rank'] . "<br>";echo "Level: " . $info['level'] . "<br>";echo "XP: " . $info['xp'] . "<br>";?></center>

Errors found:ERROR 1 (inside name box)---------------<br /><b>Notice</b>: Undefined index: name in <b>/home/www/rswildy.co.uk/AFprs/AFprsfs/hiscores.php</b> on line <b>11</b><br /> Error 2---------------Notice: Undefined index: name in /home/www/rswildy.co.uk/AFprs/AFprsfs/hiscores.php on line 16Was fine on yours but now i see errors there too. This is really strange. I really need these hiscores :)

Link to comment
Share on other sites

I disabled the errors on my version again. You can do the same on yours, the notices aren't important. The undefined index just means that $_GET['name'] is undefined, which obviously happens if you haven't entered a name yet.I'm not sure what to say, it doesn't make sense that the script would just stop executing at a certain point. Since it works on one server and not on another server, I would say that you should ask your host why it doesn't work on their server. Point them to this thread if you want to. For reference, this is the code I am running here, the only different should be the extra if statement to not show output unless a name was entered, and the form action.

<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="get" target="_self">	<td style="border-right-width:0px; border-right-style:solid; border-right-color:#261F13; width:66%; background-color:#362D1A;"><center><input type="text" name="name" value="<?php echo $_GET['name']?>" /><br /><?php$contents = "";$handle = fopen("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=".urlencode($_GET['name']),"r");if($handle){  while (!feof($handle))  {	$contents .= fread($handle, 8192);  }  fclose($handle);}function parse($skill_name){  global $contents;  $matches = array();  $pattern = "@<tr>\\s<td.*><img.*></td>\\s<td.*><a.*>\\s" . $skill_name . "\\s</a></td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s</tr>@imsU";  $match_found = preg_match($pattern, $contents, $matches);  $retval = array();  if ($match_found && $matches[1] != "")	$retval['rank'] = $matches[1];  else	$retval['rank'] = "--";  if ($match_found && $matches[2] != "")	$retval['level'] = $matches[2];  else	$retval['level'] = "--";  if ($match_found && $matches[3] != "")	$retval['xp'] = $matches[3];  else	$retval['xp'] = "--";  return $retval;}if (isset($_GET['name'])){  $info = parse("Attack");  echo "Attack:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Defence");  echo "Defence:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Strength");  echo "Strength:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Hitpoints");  echo "Hitpoints:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Ranged");  echo "Ranged:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Prayer");  echo "Prayer:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Magic");  echo "Magic:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Cooking");  echo "Cooking:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Woodcutting");  echo "Woodcutting:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Fletching");  echo "Fletching:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Fishing");  echo "Fishing:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Firemaking");  echo "Firemaking:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Crafting");  echo "Crafting:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Smithing");  echo "Smithing:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Mining");  echo "Mining:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Herblore");  echo "Herblore:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Agility");  echo "Agility:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Thieving");  echo "Thieving:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Slayer");  echo "Slayer:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Farming");  echo "Farming:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Runecraft");  echo "Runecraft:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Hunter");  echo "Hunter:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";    echo "<br>";    $info = parse("Construction");  echo "Construction:<br>";  echo "Rank: " . $info['rank'] . "<br>";  echo "Level: " . $info['level'] . "<br>";  echo "XP: " . $info['xp'] . "<br>";}?></center>

Link to comment
Share on other sites

I rewrote this, but both the old and new versions are working on 2 other servers that I tried them on. However, this should be faster and might work better for you. You can see it working here:http://www.manchine.net/w3/regexp_rs.php

<html>  <head>	<title>Scores</title>	<style>	body	{	  font-family: sans-serif;	  font-size: 10px;	}	div	{	  margin: 0 auto;	  width: 190;	  padding: 10px;	  border: 1px solid black;	  background: #E0E0E0;	}	table	{	  width: 300px;	  background: #E0E0E0;	  border: 1px solid black;	  margin: 0 auto;	}	td	{	  padding: 3px;	  font-size: 10px;	}	input	{	  font-size: 10px;	}	</style>  </head>  <body>	<div>	  Enter a name:<br />	  <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="get">		<input type="text" name="name" value="<?php echo $_GET['name']?>" />		<input type="submit" value="Go" />	  </form>	</div>	<br /><?phpif (isset($_GET['name'])){  $skill_list = array("Attack", "Defence", "Strength", "Hitpoints",					  "Ranged", "Prayer", "Magic", "Cooking", "Woodcutting",					  "Fletching", "Fishing", "Firemaking", "Crafting",					  "Smithing", "Mining", "Herblore", "Agility", "Thieving",					  "Slayer", "Farming", "Runecraft", "Hunter", "Construction");  $contents = "";  $handle = fopen("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=".urlencode($_GET['name']),"r");  if($handle)  {	while (!feof($handle))	{	  $contents .= fread($handle, 8192);	}	fclose($handle);  }  echo "<table cellpadding=\"0\" cellspacing=\"0\">";  echo "<tr>";  echo "<td style=\"border-bottom: 1px solid black;\">Skill</td>";  echo "<td style=\"border-bottom: 1px solid black;\">Rank</td>";  echo "<td style=\"border-bottom: 1px solid black;\">Level</td>";  echo "<td style=\"border-bottom: 1px solid black;\">XP</td>";  echo "</tr>";  $bg = false;  $found_skills = array();  $skills = parse($contents);  foreach ($skills as $info)  {	if ($bg)	  echo "<tr style=\"background: #D0D0D0;\">";	else	  echo "<tr>";	echo "<td>{$info['skill']}</td>";	echo "<td>{$info['rank']}</td>";	echo "<td>{$info['level']}</td>";	echo "<td>{$info['xp']}</td>";	echo "</tr>";	$found_skills[] = $info['skill'];	$bg = !$bg;  }  $missing_skills = array_diff($skill_list, $found_skills);  foreach($missing_skills as $skill)  {	if ($bg)	  echo "<tr style=\"background: #D0D0D0;\">";	else	  echo "<tr>";	echo "<td>{$skill}</td>";	echo "<td>--</td>";	echo "<td>--</td>";	echo "<td>--</td>";	echo "</tr>";	$bg = !$bg;  }  echo "</table>";}function parse($contents){  $matches = array();  $pattern = "@<tr>\\s<td.*><img.*></td>\\s<td.*><a.*>\\s([^<]+)\\s</a></td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s</tr>@imsU";  $nr_matches = preg_match_all($pattern, $contents, $matches);  $retval = array();  $i = 0;  for ($i = 0; $i < count($matches[1]); $i++)  {	$retval[$i]['skill'] = $matches[1][$i];	$retval[$i]['rank'] = $matches[2][$i];	$retval[$i]['level'] = $matches[3][$i];	$retval[$i]['xp'] = $matches[4][$i];  }  return $retval;}?>  </body></html>

Link to comment
Share on other sites

Works but.. For me if you dont enter a username it wont show any of the tables where on youres it will show no matter what, Must be my host again (However, That really doesn't matter i'll let you know if i find any other problems with it). Also i've gotta say you've saved me ALOT of time formatting it, Now im wondering how can i make overall level show up too, also including total xp, total rank, total level just the same as getting from rs hiscores but even if it isnt ranked i would like to to apear at the bottom but looking in exactly the same format :). however putting it like you've put levels wont work, You've gotta use a diffrent method for Overall level.

Link to comment
Share on other sites

If you look at the HTML code, you can see the difference between overall and the others:

<tr><td></td><td align="left"><a href="overall.ws?table=0&user=low_fighter">Overall</a></td><td align="right">164,774</td><td align="right">1335</td><td align="right">32,471,273</td></tr><tr><td align="right"><img class="miniimg" src="http://www.runescape.com/img/hiscores/skill_icon_attack1.gif"></td><td align="left"><a href="overall.ws?table=1&user=low_fighter">Attack</a></td><td align="right">27,198</td><td align="right">92</td><td align="right">6,703,537</td></tr>

The difference is that the first <td> in overall does not include an image. You can also do something like we were doing earlier where you specifically look for the Overall block. You could edit the one regular expression so that the img element is optional, or create a new expression for the overall block specifically. But I took you through the process that I used to create the initial regular expression, so read through that and see if you can create the new pattern.

Link to comment
Share on other sites

So either check for the name "overall" when you are deciding whether or not to print it, and if so save it in a variable until the end, or have the main pattern get everything except the overall block, and then have a second pattern at the end find just the overall block and display that.

Link to comment
Share on other sites

I don't quite understand that, Also now im wondering lets say the page hiscores is located at ?id=hiscore then looking up user so output of my url is ?id=hiscore&user=user+name now lets say i wanted to add a private hiscore for one stat alone for example if they go to ?id=hiscore&uer=user+name is the current output the code is:

<html>  <head>	<title>Hiscore Lookup</title>	<style>	body	{	  font-family: sans-serif;	  font-size: 10px;	  background: #CCCCCC;	}	div	{	  margin: 0 auto;	  width: 190;	  padding: 10px;	  border: 1px solid black;	  background: #E0E0E0;	}	table	{	  width: 300px;	  background: #E0E0E0;	  border: 1px solid black;	  margin: 0 auto;	}	td	{	  padding: 3px;	  font-size: 10px;	}	input	{	  font-size: 10px;	}	</style>  </head>  <body>  <center>	<div>	  Enter a name:<br />	  <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="get">	  <input type="hidden" name="id" value="hiscore">		<input type="text" name="user" value="<?php echo $_GET['user']?>" />		<input type="submit" value="Go" />	  </form>	</div>  </center>	<br /><center><?phpif (isset($_GET['user'])){  $skill_list = array("Attack", "Defence", "Strength", "Hitpoints",					  "Ranged", "Prayer", "Magic", "Cooking", "Woodcutting",					  "Fletching", "Fishing", "Firemaking", "Crafting",					  "Smithing", "Mining", "Herblore", "Agility", "Thieving",					  "Slayer", "Farming", "Runecraft", "Hunter", "Construction");  $contents = "";  $handle = fopen("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=".urlencode($_GET['user']),"r");  if($handle)  {	while (!feof($handle))	{	  $contents .= fread($handle, 8192);	}	fclose($handle);  }  echo "<table cellpadding=\"0\" cellspacing=\"0\">";  echo "<tr>";  echo "<td style=\"border-bottom: 1px solid black;\">Skill</td>";  echo "<td style=\"border-bottom: 1px solid black;\">Rank</td>";  echo "<td style=\"border-bottom: 1px solid black;\">Level</td>";  echo "<td style=\"border-bottom: 1px solid black;\">XP</td>";  echo "</tr>";  $bg = false;  $found_skills = array();  $skills = parse($contents);  foreach ($skills as $info)  {	if ($bg)	  echo "<tr style=\"background: #D0D0D0;\">";	else	  echo "<tr>";	echo "<td>{$info['skill']}</td>";	echo "<td>{$info['rank']}</td>";	echo "<td>{$info['level']}</td>";	echo "<td>{$info['xp']}</td>";	echo "</tr>";	$found_skills[] = $info['skill'];	$bg = !$bg;  }  $missing_skills = array_diff($skill_list, $found_skills);  foreach($missing_skills as $skill)  {	if ($bg)	  echo "<tr style=\"background: #D0D0D0;\">";	else	  echo "<tr>";	echo "<td>{$skill}</td>";	echo "<td>--</td>";	echo "<td>--</td>";	echo "<td>--</td>";	echo "</tr>";	$bg = !$bg;  }  echo "</table>";}function parse($contents){  $matches = array();  $pattern = "@<tr>\\s<td.*><img.*></td>\\s<td.*><a.*>\\s([^<]+)\\s</a></td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s</tr>@imsU";  $nr_matches = preg_match_all($pattern, $contents, $matches);  $retval = array();  $i = 0;  for ($i = 0; $i < count($matches[1]); $i++)  {	$retval[$i]['skill'] = $matches[1][$i];	$retval[$i]['rank'] = $matches[2][$i];	$retval[$i]['level'] = $matches[3][$i];	$retval[$i]['xp'] = $matches[4][$i];  }  return $retval;}?></center>  </body></html>

Now i don't want to remove the full hiscore i just want to make it so if they url that is used is ?id=hiscore&user=user+name&stat=attack would just show the attack stats and will not show any other stats, it would also be ok if they choose what other stats to show example id=hiscore&user=user+name&stat=attack&stat=slayer&stat=firemaking if you could do that i would be very greatfull.Thanx for your time, rswildy.

Link to comment
Share on other sites

id=hiscore&user=user+name&stat=attack&stat=slayer&stat=firemaking

It wouldn't work to have multiple variables with the same name, the server would only save one value for the stat variable. It can't have more then one value. If you want to pass a list, you need to use array syntax, and put the brackets after the name. That will cause PHP to add each value to an array instead of overwrite the same variable with the new value.

id=hiscore&user=user+name&stat[]=attack&stat[]=slayer&stat[]=firemaking

So you can have several checkboxes called stat[] with the different values. You could also do it with a multiple select list, and that would result in a comma-separated string that you would split apart into an array yourself. Once you have the skill names in an array, you would check to see if the current skill is in the array.

foreach ($skills as $info){  if (in_array($info['skill'], $stat))  {	//show it  }}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...