The most viewed posts

Registry Reviver

Web Development Services

Contact Me

How to clean up Windows Computer

About Desktop Icons in Windows Computer

Driver Booster

CCleaner

How to make a computer secure and run faster

Myanmar font and keyboard for Windows

Advanced System Care

The most viewed items

Dell Inspiron 5559

Desktop Hard Disk

Laptop RAM

SONY Playstation Portable

HP ProBook 430

External Hard Disk

Laptop

Please login to start chat

ZilaStar ICT Jun 12 2019, 16:54:42
Category : php tutorials

Wordcensoring in php

From the following example, you can learn the usage of form, textarea, isset, strtolower and str_replace. Every word 'love' you type in the text box, the codes will change with the word 'hate'.

<?php
$find = 'love';
$replace = 'hate';
if(isset($_POST['user_input']) && !empty($_POST['user_input'])){
   $user_input = strtolower($_POST['user_input']);
   $user_input_new = str_replace($find, $replace, $user_input);
   echo $user_input_new.'</br>';
}else{
  echo 'Please fill in the text box!';
}
?>

<form action = "wordcensoring.php" method = "POST">
<textarea name = "user_input" cols = "40" widths = "500"></textarea></br></br>
<input type = "submit" value = "Submit">
</form>

  • Comments:

    No comment to show.

    To Contact
    Available Services
    Terms and Conditions