Jump to content

Adding text via image clicking


manix

Recommended Posts

Ok so what I have is this and it's supposed to add the emoticon characters to the textarea upon clicking.. but it's not :s

 

<form method="post" action="update.php" name="share">
			<div align="center">3aglawie <input type="text" name="header" size="95" maxlength="35"/><br>
			<textarea id="story" rows="25" cols="80" maxlength="10000"></textarea><br>
<? $emote = array(
    "(hi)" => "hi.gif",
    "(f:))" => "fake_smile.gif",
":@" => "angry.png",
"(devil)" => "devil.gif",
"" => "lol.png",
"(lowpatience)" => "bomb.gif",
"O_O" => "O_O.gif",
";(" => "cry.gif",
"Zzz" => "sleeping.gif",
"(ninja)" => "ninja.gif",
"X_X" => "x_x.gif",
":*" => "kiss.gif",
"(angel)" => "angel.png",
);
foreach($emote as &$value) {
$temp = key($emote);
echo "<img src='emos/{$value}' title='$value' onclick='share.story.value=share.story.value + $temp' />"; 
}
?>

Link to comment
https://forums.phpfreaks.com/topic/240361-adding-text-via-image-clicking/
Share on other sites

Change the loop to this, as it makes more sense,

also the title should really be the key as well!

 

foreach($emote as $key => $value) {
  echo "<img src='emos/{$value}' title='$key' onclick='share.story.value=share.story.value + \"$key\"' />";
}

 

as for what image are being displayed after the post.. thats in some unposted script

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.