find & replace problem

+2 Erp Eight · September 7, 2014
<?php

if(isset($_POST["text"])&&isset($_POST["searchfor"])&& isset($_POST["replacewith"])){
$text = $_POST["text"];
$search = $_POST["searchfor"];
$replace = $_POST["replacewith"];


if(!empty($text)&&!empty($search)&&!empty($replace)){
echo "yeah!";
}else{
echo"fill all field";
}
}
?>

<form action='index.php' method="POST"><br>
<textarea type="text" rows="5" cols='33'></textarea><br><br>
Find for:<BR><br>
<input type="text" name="searchfor"><br><br>
Replace with:<br><br>
<input type="text" name="replacewith"><br><br>
<input type="submit" value="Submit!!!"><br>
</form>

when the page opens and then i click submit button it just reloads the page and no errors are given by php

Post a Reply

Replies

Oldest  Newest  Rating
+2 Franz Schmidt · September 7, 2014
I think you forgot the name attribut from the textarea in your html section.

So the POST of text will never be set. (isset won't  be true)
+2 Erp Eight · September 8, 2014
thank u buddy!!! it works 
8-)
  • 1

PHP

107,110 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators