I have a webpage that basically is designed to allow people to enter HTML text into a textarea box, and when they click the preview button, it previews the html they entered into the box.
If they are happy with the preview they can then hit submit again and have the html data entered into the database.
The problem I have is that for some reason, when its submitted, PHP is printing all the data TWICE, although nowhere is it told to do it.. Here is the code:
Code: Select all
<!-- Render page preview -->
<?php
if($_POSTїsubmit])
{
echo "<img src="$_POSTїtitle_image]"><center><br><em>$_POSTїauthor] : $_POSTїdate]</em></center><br><br>";
$article_fixed = str_replace(""e;, "", $_POSTїarticle_text]);
echo "$_POSTїteaser]<br><br>";
echo $article_fixed;
echo "<form method="post" action="insert_article.php">";
echo "<input type="hidden" name="date" value="$_POSTїdate]">";
echo "<input type="hidden" name="author" value="$_POSTїauthor]">";
echo "<input type="hidden" name="title_image" value="$_POSTїtitle_image]">";
echo "<input type="hidden" name="title" value="$_POSTїtitle]">";
echo "<input type="hidden" name="teaser" value="$_POSTїteaser]">";
printf("<input type="hidden" name="article" value="%s"", $article_fixed);
echo "<br><br><input type="submit" value="Submit">";
echo "</form>";
}
else //Display forms
{ ?>
<form method="POST" action="insert.php" enctype="text/plain">
<bold>Date :</bold><br><br><input type="text" name="date"><br><br>
<bold>Author :</bold><br><br><input type="text" name="author"><br><br>
<bold>Title Image :</bold><br><br><input type="text" name="title_image"><br><br>
<bold>Title :</bold><br><br><input type="text" name="title"><br><br>
<bold>Teaser :</bold><br><br><textarea name="teaser" cols="60" rows="15"></textarea>
<bold>Article :</bold><br><br><textarea name="article_text" cols="60" rows="30"></textarea>
<input type="submit" value="Preview" name="submit">
</form>
<?php
} ?>