Jump to content

$arr help


Makeshift67

Recommended Posts

hey guys. i have recently made a few coded fonts to secure my information on my website.

i recently tried making a page where i type in a sentence or word, and it posts that sentence into 3 other textarea fields using my coded font, but i only want it to pretty much scramble the letters.

 

one of my coded fonts uses a=z b=y c=x etc.

 

I've been trying to use $arr to make this possible.

i tried to do "echo $arr[$text'];" but it didn't work.

 

here's my code.

 

<?php
$text = $_REQUEST['text'];
$arr = array("a" => "z", "b" => "y", "c" => "x");
?>

<form method="POST" action="<?php echo $SERVER['PHP_SELF']; ?>">
<table align="center" border="0" style="color:#000;">
<tr valign="top">
	<td>
<textarea name="text" rows="5" cols="30"></textarea><br />
<input type="submit" value="Submit" name="submit"> | <input type="reset" value="Reset" />
	</td>
</tr>
</table>
</form>
<br /><br />
<table align="center">
<tr valign="top">
	<td align="center">
<textarea name="text" rows="5" cols="30"><?php echo stripslashes($text); ?></textarea></form>
	</td>
<td align="center">
<textarea name="text" rows="5" cols="30"><?php echo stripslashes($text); ?></textarea></form>
	</td>
<td align="center">
<textarea name="text" rows="5" cols="30"><?php echo stripslashes($text); ?></textarea></form>
	</td>
<td align="center">
<textarea name="text" rows="5" cols="30"><?php echo stripslashes($text); ?></textarea></form>
	</td>
</tr>
</table>

Link to comment
https://forums.phpfreaks.com/topic/150949-arr-help/
Share on other sites

well, i put the code on there to help people trying to help me by giving them an idea of what i have set up.

 

i summed up the code on there. on the actual coding, the text in the textarea has the face of my fonts, which i dont wanna do anymore.

 

i wanna change the actual letters, not the way they look.

Link to comment
https://forums.phpfreaks.com/topic/150949-arr-help/#findComment-793058
Share on other sites

<?php
$text = $_REQUEST['text'];
$arr = array('a', 'b', 'c');
$arr2=array('z','y','x'); str_replace($arr, $arr2, $text);

?>

However it would be better if you used preg_replace() . As this is a higher level and faster method for matching and replacing large strings of text. Please read and apply: http://us3.php.net/manual/en/function.preg-replace.php

Link to comment
https://forums.phpfreaks.com/topic/150949-arr-help/#findComment-793161
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.