manix Posted June 25, 2011 Share Posted June 25, 2011 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' />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/240361-adding-text-via-image-clicking/ Share on other sites More sharing options...
MadTechie Posted June 25, 2011 Share Posted June 25, 2011 The brackets will cause some issules, try this instead echo "<img src='emos/{$value}' title='$value' onclick='share.story.value=share.story.value + \"$temp\"' />"; Quote Link to comment https://forums.phpfreaks.com/topic/240361-adding-text-via-image-clicking/#findComment-1234648 Share on other sites More sharing options...
manix Posted June 25, 2011 Author Share Posted June 25, 2011 well it's working now but it's kinda messy, I'll try to figure it out. Quote Link to comment https://forums.phpfreaks.com/topic/240361-adding-text-via-image-clicking/#findComment-1234656 Share on other sites More sharing options...
MadTechie Posted June 25, 2011 Share Posted June 25, 2011 What do you mean "messy" ? Quote Link to comment https://forums.phpfreaks.com/topic/240361-adding-text-via-image-clicking/#findComment-1234657 Share on other sites More sharing options...
manix Posted June 25, 2011 Author Share Posted June 25, 2011 well if this is my line with emotes: for example when i click then is being displayed another example > Quote Link to comment https://forums.phpfreaks.com/topic/240361-adding-text-via-image-clicking/#findComment-1234658 Share on other sites More sharing options...
MadTechie Posted June 25, 2011 Share Posted June 25, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/240361-adding-text-via-image-clicking/#findComment-1234661 Share on other sites More sharing options...
manix Posted June 25, 2011 Author Share Posted June 25, 2011 hey thanks man, really appreciate it! Quote Link to comment https://forums.phpfreaks.com/topic/240361-adding-text-via-image-clicking/#findComment-1234665 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.