OK, just so I fully understand this I can't "include" this page "image.php" in my "image2.php" page if I use any HTML unless I call it as an image source.
My example (above) is a simplified version of a page that I am trying to create that would let me send text via form post to an image (using the GD library) that shows the image with the text on the same page. Sort of an instant proof you might say. I can do it using an "iframe" but I would like to inbed the image instead and not use that approach. The problem is that it will not post to the image2.php when I bring it into the page via <img src = "image2.php">
I was assuming that bringing it in via an "include' would solve my problem.
Here is my real code:
<?php
// start the session
session_start();
header("Cache-control: private"); //IE 6 Fix
// Get the user's input from the text field
$string = $POST['text'];
// Register session key with the value
$SESSION['text'] = $string;
// Get the user's input from the text2 field
$string2 = $POST['text2'];
// Register session key with the value
$SESSION['text2'] = $string2;
?>
<!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>Test Proof</title>
</head>
<body>
<table width="50%" border="4" cellspacing="2" cellpadding="2">
<tr>
<td>
<img src="postcard2-iframe2.php">
</td>
</tr>
</table>
<br>
<form action="<?=( $SERVER['PHP_SELF'] )?>" method="post" name="form1">
<input name="text" type="text" id="text" value="" size="40" maxlength="40">
<br>
<input name="text2" type="text" id="text2" size="34" maxlength="34">
<br>
<input type="submit" name="Submit" value="Submit">
</form>
<br>
Verify session Info:
<br>
<?php echo $SESSION['text']; ?>
<br>
<?php echo $_SESSION['text2']; ?>
</body>
</html>
postcard2-iframe2.php code:
<?php
// start the session
session_start();
header("Cache-control: private"); //IE 6 Fix
// Get the user's input from the form
$string = $POST['text'];
// Register session key with the value
$SESSION['text'] = $string;
// Get the user's input from the form
$string2 = $POST['text2'];
// Register session key with the value
$SESSION['text2'] = $string2;
header("Content-type: image/png");
// load base card image
$im = imagecreatefrompng("web-images/base-back-web.png");
// color defs -rgb-
$green = imagecolorallocate($im, 95, 172, 172);
$black = imagecolorallocate($im, 0, 0, 0);
// first text field
$string = $SESSION['text'];
// fonts for first field
imagettftext($im, 10, 0, 10, 100, $black, "fonts/arial.ttf", $string);
// second text field
$string2 = $SESSION['text2'];
// fonts for second field
imagettftext($im, 10, 0, 10, 300, $green, "fonts/arial.ttf", $string2);
// produce and kill
imagepng($im);
imagedestroy($im);
?>
If I post to the "postcard2-iframe2.php" code I get results but I need it to show inline where the form is...
Again I am assuming that an "include" would fix it, but I may be wrong...