Gruzin Posted October 18, 2006 Share Posted October 18, 2006 Hi everybody,I am trying to write a simple bbcode for images, it works ok, I mean it does insert the image but my problem is that it doesn't insert any other text with image. here is the little code:[code]<?php$textarea = $_POST['textarea'];$smilies = array( ':)' => 'smile.jpg', ':(' => 'sad.jpg', );$codes = array_keys($smilies);$textarea = str_replace($codes,$smilies,$textarea);?><html><body><center><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><table width="400" border="0" cellspacing="4" cellpadding="0"> <tr> <td align="center"><textarea name="textarea" cols="50" rows="8"></textarea></td> </tr> <tr> <td align="center"><input type="submit" value="Go" name="post"></td> </tr></table></form><?phpif(isset($_POST['post'])){echo "<table width='100' border='0' cellspacing='0' cellpadding='0'> <tr> <td><img src=".$textarea."> </td> </tr></table>";}?></center></body></html>[/code]Any help will be very appreciated,George Link to comment https://forums.phpfreaks.com/topic/24306-solved-simple-question-about-bbcode/ Share on other sites More sharing options...
Gruzin Posted October 18, 2006 Author Share Posted October 18, 2006 *Bump* Link to comment https://forums.phpfreaks.com/topic/24306-solved-simple-question-about-bbcode/#findComment-110562 Share on other sites More sharing options...
.josh Posted October 18, 2006 Share Posted October 18, 2006 [code]<?php$textarea = $_POST['textarea'];$smilies = array( ':)' => "<img src =\'smile.jpg\'>", ':(' => "<img src = \'sad.jpg\'>", );$codes = array_keys($smilies);$textarea = str_replace($codes,$smilies,$textarea);?><html><body><center><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><table width="400" border="0" cellspacing="4" cellpadding="0"> <tr> <td align="center"><textarea name="textarea" cols="50" rows="8"></textarea></td> </tr> <tr> <td align="center"><input type="submit" value="Go" name="post"></td> </tr></table></form><?phpif(isset($_POST['post'])){echo "<table width='100' border='0' cellspacing='0' cellpadding='0'> <tr> <td> $textarea </tr></table>";}?></center></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/24306-solved-simple-question-about-bbcode/#findComment-110564 Share on other sites More sharing options...
Gruzin Posted October 18, 2006 Author Share Posted October 18, 2006 Thanks Crayon,It works, but without double quotes ;) Link to comment https://forums.phpfreaks.com/topic/24306-solved-simple-question-about-bbcode/#findComment-110565 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.