text dump

A

Anonymous

Guest
Im making a calculator that calculate the power of gems (don't ask :p)

I want to copy and paste all the gems I got into a textarea and then calculate the power.

So, my problem is how do I make variables or put the text into a array (not quite sure what method to use) to split each line up and make variables out of them (don't know if this is the right solution) so I can for each line calculate the power and then echo it out.

Sorry if im not clear enough but I hope you understand my problem Smile

Edit: B.t.w, the tekst I will paste looks like this:

Ugly level 40 Fen Gem (destroy)
Beautiful level 40 Fen Gem (destroy)

The information I need is:
Quality(Ugly, Beautiful, Magnificent, Exquisite)
Level (1-100)
gem(fen, ner, efis, qaera, whatever)
 
suppose you have
Code:
<textarea name='gems' rows='10' cols='10'></textarea>
and the page you submit...

Code:
<?php
$gems = explode("\r\n", trim($_POST['gems']));
// $gems will be an array
?>
 
and how could I echo out the information from that array?
 
Code:
<?
	for($i=0;$i<count($gems);$i++)
	{
		print $gems[$i];	
	}
?>
 
Back
Top