Hey, i was just wondering if anyone could help me with this dynamic image creator. Everything seems to be working fine, except when the text is inputted, it does not show up. Here is the website...http://thematking.com/residential/doormats/vinyl-link/test2.php and here are the codes
The code for the image
<?php
$txt = htmlspecialchars(stripslashes($_GET['txt']));
$image = imagecreatefrompng("images/backgroundsmall.png");
$color = imagecolorallocate($image, 100, 100, 100);
imagestring ($image, 3, 10, 9, $txt, $color);
imagepng($image);
imagedestroy($image);
?>
and the code for the page
<?php require ($_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>images</title>
</head>
<body>
<form name="imagetext" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<label for="text">Enter your text: </label><input type="text" value="" name="txt" size="10" maxlength="20">
<input type="submit">
</form>
<?php
if(isset($_POST['submit'])) {
$txt = htmlspecialchars(stripslashes($_GET['txt']));
echo "<img src='test.php?txt=$txt' alt='echo image'>";
} else {
echo "<img src='test.php' alt='elseif image'>";
}
?>
</body>
</html>
any help would be appreciated..thanks.
edit - looking at it with the code, it looks like theres something wrong with the form part on the page, how can i write that cleaner?