187. PHP Program to delete particular word from the given paragraph.
How does this program work?
- This program is used to delete particular word from the given paragraph using PHP.
Here is the code
<html>
<head>
<title>PHP Program To delete particular word from the given paragraph</title>
</head>
<body>
<form method="post">
<table border="0">
<tr>
<td> <textarea name="name" style= "width:150px; height:150px;"placeholder="Write a paragraph"> </textarea > </td>
</tr>
<tr>
<td> <input type="text" name="name2" value="" placeholder="Enter delete word"/> </td>
</tr>
<tr>
<td> <input type="submit" name="submit" value="Submit"/> </td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit'])) {
$str = $_POST['name'];
$s1 = $_POST['name2'];
echo "Original paragraph : </br>";
echo $str;
echo "After deleting the new paragraph is :</br>";
echo str_replace($s1,'-', $str);
return 0;
}
?>
</body>
</html>