MrD
MrD

Reputation: 5084

GD Library Image to Text Extended to include HTML?

I have the follwing code:

<?php
$email = $_REQUEST["email"];

if(!empty($Email)) {

echo"<img src=\"generatePic.php?em=" . $email . " />";

}
?>

<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="get" />
<table>
<tr>
<td>Your E-mail</td><td><input type="text" name="email" /></td>
</tr>
<tr>
<td><input type="submit" value="Imagefy Me!" /></td><td>&nbsp;</td>
</tr>
</table>
</form>

When I submit a string, however, the image returned contains the string, but also part of <form action="... as part of the string printed to the picture... Any suggestions on how I could avoid this?

Upvotes: 0

Views: 56

Answers (1)

xdazz
xdazz

Reputation: 160953

Email has @ inside it, so you need urlencode it, and you missed the quote.

echo"<img src=\"generatePic.php?em=" . urlencode($email) . "\" />";

Upvotes: 1

Related Questions