33 lines
780 B
PHP
Executable File
33 lines
780 B
PHP
Executable File
|
|
<?php
|
|
|
|
$offset = 0;
|
|
|
|
if(isset($_POST['text']) && isset($_POST['searchfor']) && isset($_POST['replacewith'])){
|
|
$text = $_POST['text'];
|
|
$search = $_POST['searchfor'];
|
|
$replace = $_POST['replacewith'];
|
|
|
|
$search_length = strlen($search);
|
|
|
|
if(!empty($text) && !empty($search) && !empty($replace)){
|
|
|
|
$text = str_ireplace($search, $replace, $text);
|
|
echo $text;
|
|
}else{
|
|
echo 'Please fill in all fields.';
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<form action="FindAndReplace.php" method="POST">
|
|
<textarea name="text" cols="30" rows="7"></textarea><br><br>
|
|
|
|
Search for: <br>
|
|
<input type="text" name = "searchfor" ><br><br>
|
|
Replace with: <br>
|
|
<input type="text" name = "replacewith" ><br><br>
|
|
<input type = "submit" value = "Find and replace">
|
|
</form>
|