Hi,
I'm trying to make a form where a surfer can enter a list of words in a text box, then the script spits out the words and their corresponding md5 value in a table. But I end up with it just doing the first letter of the first word they entered.
Here's my code:
<?php
$data='';
if (isset($_POST['data']) && strlen($_POST['data'])>0) {
$data=$_POST['data'];
}
if (isset($_POST['submit']))
{
if (strlen($data)>0)
{
$newarr = explode("\n\r", $data);
print '<b>Results</b><br><br>';
print '<table width = "800" columns = "2" border = "2">';
foreach($newarr as $line)
{
print '<tr>';
print '<td>';
print $newarr{$line};
print '</td>';
print '<td>';
print md5($newarr{$line});
print '</td>';
print '</tr>';
}
print '</table><br><br>';
}
else
print '<b>You need to enter some data</b><br><br>';
}
?>
<b>Enter data here</b><br><br>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<textarea name="data" rows="15" cols="100">
<?php echo $data; ?>
</textarea>
<input type="submit" value="Submit" name="submit">
</form>
I've tried diff combinations of \n\r but I think what's happening is I'm not getting to the next line? Any ideas?
Just to be clear, I want to md5 each individual line in the box...
so they enter like:
word1
blah
meh
and then the script spits out
word1 fkgjdfkgjf98454b
blah rRmfgTlfm459839t
meh j453fjvBEmtltjk
etc.
thanks