Form question
Moderator: General Moderators
- akimm
- Forum Contributor
- Posts: 460
- Joined: Thu Apr 27, 2006 10:50 am
- Location: Ypsilanti Michigan, formally Clipsburgh
Form question
I have tried creating in html a form to use with a php program i'm creating that will allow me to enter journal entrys onto my website.
Everything is koscher besides my Emoticons. I am trying to use emoticons in a dropdown menu, i have them all saved on my server, but when i make the menu with all the images referred to in the options list there is nothing but a box that is blank.
Any idea on how i may implement smileys into this form?
Everything is koscher besides my Emoticons. I am trying to use emoticons in a dropdown menu, i have them all saved on my server, but when i make the menu with all the images referred to in the options list there is nothing but a box that is blank.
Any idea on how i may implement smileys into this form?
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
- akimm
- Forum Contributor
- Posts: 460
- Joined: Thu Apr 27, 2006 10:50 am
- Location: Ypsilanti Michigan, formally Clipsburgh
here is the tiny part thats jacked up
Code: Select all
<select name="smile">
<option value="<img src='/journal06/smile/*******.gif'>"><img src='/journal06/smile/*******.gif'>
</select>[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:5. People of all ages visit this forum - no profanity please. Same goes for sexual content, extreme violence or content deemed not appropriate or links to such.
- akimm
- Forum Contributor
- Posts: 460
- Joined: Thu Apr 27, 2006 10:50 am
- Location: Ypsilanti Michigan, formally Clipsburgh
if you like
i got the whole code here, but i figured that would be troublesome, since I don't really need to aid there.
- akimm
- Forum Contributor
- Posts: 460
- Joined: Thu Apr 27, 2006 10:50 am
- Location: Ypsilanti Michigan, formally Clipsburgh
yea i figured as much when it can up blank
Would there be an easy solution, maybe create an array in javascript or php then just call on the array index of each smile?
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Code: Select all
<img src="path/to/image" />Code: Select all
<img src="<img src="path/to/img" />" />Code: Select all
// some kind of loop
echo '<option value="'.$smiley_path.'">'.$smiley_name.'</option>';
// end loop- akimm
- Forum Contributor
- Posts: 460
- Joined: Thu Apr 27, 2006 10:50 am
- Location: Ypsilanti Michigan, formally Clipsburgh
here is my best attempt at using javascript
Code: Select all
<script type="text/javascript">
<img src="001_9898.gif" name="001_9898">
<img src="001_icon16.gif" name="001_icon16">
<img src="1eye.gif" name="1eye">
<img src="2guns.gif" name="2guns">
<img src="alien.gif" name="alien">
<img src="alucard.gif" name="alucard">
<img src="angel.gif" name="angel">
<img src="arabia.gif" name="arabia">
<img src="<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>.gif" name="<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>">
<img src="balloon.gif" name="ballon">
<img src="ban.gif" name="ban">
<img src="batman.gif" name="batman">
<img src="beta1.gif" name="beta1">
<img src="boat.gif" name="boat">
<img src="censored.gif" name="censored">
<img src="chef.gif" name="chef">
<img src="chinese.gif" name="chinese">
<img src="chris.gif" name="chris">
<img src="clap.gif" name="clap">
<img src="clover.gif" name="clover">
<img src="clap.gif" name="clap">
<img src="clover.gif" name="clover">
<img src="clown.gif" name="clown">
<img src="cool2.gif" name="cool2">
<img src="cowboy.gif" name="cowboy">
<img src="death.gif" name="death">
<img src="detective.gif" name="detective">
<img src="devil.gif" name="devil">
<img src="devil2.gif" name="devil2">
<img src="donatello.gif" name="donatello">
<img src="dots.gif" name="dots">
<img src="double <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>.gif" name="double <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>">
<img src="eek.gif" name="eek">
<img src="euro.gif" name="euro">
<img src="excl.gif" name="excl">
<img src="flowers.gif" name="flowers">
<img src="<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>-8.gif" name="<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>-8">
<img src="fuk2.gif" name="fuk2">
<img src="gun_bandana.gif" name="gun_bandana">
<img src="gunsmile.gif" name="gunsmile">
<img src="hammer.gif" name="hammer">
<img src="hang.gif" name="hang">
<img src="happybday.gif" name="happybday">
<img src="helpsmile.gif" name="helpsmile">
<img src="innocent.gif" name="innocent">
<img src="kiss.gif" name="kiss">
<img src="ninja.gif" name="ninja">
<img src="no.gif" name="no">
<img src="nono.gif" name="nono">
<img src="nuke.gif" name="nuke">
<img src="offtopic.gif" name="offtopic">
<img src="online2long.gif" name="online2long">
<img src="oops.gif" name="oops">
<img src="osama.gif" name="osama">
<img src="ph34r.gif" name="ph34r">
<img src="phone.gif" name="phone">
<img src="pinch.gif" name="pinch">
<img src="puke.gif" name="puke">
<img src="red_indian.gif" name="red_indian">
<img src="rockon.gif" name="rockon">
<img src="rolleyes.gif" name="rolleyes">
<img src="saddam.gif" name="saddamm">
<img src="sailor.gif" name="sailor">
<img src="santa.gif" name="santa">
<img src="shaun.gif" name="shaun">
<img src="shifty.gif" name="shifty">
<img src="<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>.gif" name="<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>">
<img src="shruriken.gif" name="shuriken">
<img src="single <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>.gif" name="single <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>">
<img src="sleep1.gif" name="sleep1">
<img src="sleeping.gif" name="sleeping">
<img src="smartass.gif" name="smartass">
<img src="sorcerer.gif" name="sorcerer">
<img src="stuart.gif" name="stuart">
<img src="stupid.gif" name="stupid">
<img src="surrender.gif" name="surrender">
<img src="sweatdrop.gif" name="sweatdrop">
<img src="tank.gif" name="tank">
<img src="taz.gif" name="taz">
<img src="tooth.gif" name="tooth">
<img src="tt1.gif" name="tt1">
<img src="tt2.gif" name="tt2">
<img src="turned.gif" name="turned">
<img src="wacko.gif" name="wacko">
<img src="walkman.gif" name="walkman">
<img src="wheelchair.gif" name="wheelchair">
<img src="whistling.gif" name="whistling">
<img src="winkiss.gif" name="winkiss">
<img src="wub.gif" name="wub">
<img src="yawn.gif" name="yawn">
<img src="yes.gif" name="yes">
<img src="yinyang.gif" name="yinyang">
</script>
<select name="smiles">
<script type="text/javascript">
<option value="document.images['0']">document.images['0'];
<option value="document.images['1']">document.images['1'];
<option value="document.images['2']">document.images['2'];
<option value="document.images['3']">document.images['3'];
<option value="document.images['4']">document.images['4'];
<option value="document.images['5']">document.images['5'];
<option value="document.images['6']">document.images['6'];
<option value="document.images['7']">document.images['7'];
<option value="document.images['8']">document.images['8'];
<option value="document.images['9']">document.images['9'];
<option value="document.images['10']">document.images['10'];
<option value="document.images['11']">document.images['11'];
<option value="document.images['12']">document.images['12'];
<option value="document.images['13']">document.images['13'];
<option value="document.images['14']">document.images['14'];
<option value="document.images['15']">document.images['15'];
<option value="document.images['16']">document.images['16'];
<option value="document.images['17']">document.images['17'];
<option value="document.images['18']">document.images['18'];
<option value="document.images['19']">document.images['19'];
<option value="document.images['20']">document.images['20'];
<option value="document.images['21']">document.images['21'];
<option value="document.images['22']">document.images['22'];
<option value="document.images['23']">document.images['23'];
<option value="document.images['24']">document.images['24'];
<option value="document.images['25']">document.images['25'];
<option value="document.images['26']">document.images['26'];
<option value="document.images['27']">document.images['27'];
<option value="document.images['28']">document.images['28'];
<option value="document.images['29']">document.images['29'];
<option value="document.images['30']">document.images['30'];
<option value="document.images['31']">document.images['31'];
<option value="document.images['32']">document.images['32'];
<option value="document.images['33']">document.images['33'];
<option value="document.images['34']">document.images['34'];
<option value="document.images['35']">document.images['35'];
<option value="document.images['36']">document.images['36'];
<option value="document.images['37']">document.images['37'];
<option value="document.images['38']">document.images['38'];
<option value="document.images['39']">document.images['39'];
<option value="document.images['40']">document.images['40'];
<option value="document.images['41']">document.images['41'];
<option value="document.images['42']">document.images['42'];
<option value="document.images['43']">document.images['43'];
<option value="document.images['44']">document.images['44'];
<option value="document.images['45']">document.images['45'];
<option value="document.images['46']">document.images['46'];
<option value="document.images['47']">document.images['47'];
<option value="document.images['48']">document.images['48'];
<option value="document.images['49']">document.images['49'];
<option value="document.images['50']">document.images['50'];
<option value="document.images['51']">document.images['51'];
<option value="document.images['52']">document.images['52'];
<option value="document.images['53']">document.images['53'];
<option value="document.images['54']">document.images['54'];
<option value="document.images['55']">document.images['55'];
<option value="document.images['56']">document.images['56'];
<option value="document.images['57']">document.images['57'];
<option value="document.images['58']">document.images['58'];
<option value="document.images['59']">document.images['59'];
<option value="document.images['60']">document.images['60'];
<option value="document.images['61']">document.images['61'];
<option value="document.images['62']">document.images['62'];
<option value="document.images['63']">document.images['63'];
<option value="document.images['64']">document.images['64'];
<option value="document.images['65']">document.images['65'];
<option value="document.images['66']">document.images['66'];
<option value="document.images['67']">document.images['67'];
<option value="document.images['68']">document.images['68'];
<option value="document.images['69']">document.images['69'];
<option value="document.images['70']">document.images['70'];
<option value="document.images['71']">document.images['71'];
<option value="document.images['72']">document.images['72'];
<option value="document.images['73']">document.images['73'];
<option value="document.images['74']">document.images['74'];
<option value="document.images['75']">document.images['75'];
<option value="document.images['76']">document.images['76'];
<option value="document.images['77']">document.images['77'];
<option value="document.images['78']">document.images['78'];
<option value="document.images['79']">document.images['79'];
<option value="document.images['80']">document.images['80'];
<option value="document.images['81']">document.images['81'];
<option value="document.images['82']">document.images['82'];
<option value="document.images['83']">document.images['83'];
<option value="document.images['84']">document.images['84'];
<option value="document.images['85']">document.images['85'];
<option value="document.images['86']">document.images['86'];
<option value="document.images['87']">document.images['87'];
<option value="document.images['88']">document.images['88'];
<option value="document.images['89']">document.images['89'];
<option value="document.images['90']">document.images['90'];
<option value="document.images['91']">document.images['91'];
</script>
</select>- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
The reason it doesn't work is because you didn't put any javascript inside of your <script> tags.
What you tried to do was print images to the screen.
HTML, JavaScript, and PHP are three completely different things.
Store the paths and names of the smileys in a database and then iterate through the result, like this:
What you tried to do was print images to the screen.
HTML, JavaScript, and PHP are three completely different things.
Store the paths and names of the smileys in a database and then iterate through the result, like this:
Code: Select all
mysql_connect($host, $user, $pass);
mysql_select_db($db_name);
$query = "SELECT name, path FROM simleys";
$result = mysql_query($query);
echo '<select name="smiley">';
while ($row = mysql_fetch_row($result))
{
$name = $row[0];
$path = $row[1];
echo '<option value="'.$path.'">'.$name.'</option>';
}
echo '</select>';- akimm
- Forum Contributor
- Posts: 460
- Joined: Thu Apr 27, 2006 10:50 am
- Location: Ypsilanti Michigan, formally Clipsburgh
I would use a DB
but i am still trying to get my apache server up, and the current server i use doesn't provide a db.
I am doing all my journal thru a flatfile.
I am doing all my journal thru a flatfile.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Have a read trough PHP arrays. Then create an array to loop through with your image names only. Use the key of the array as your option value in your drop down list and use that key in conjunction with your array name to actually show the image.
- akimm
- Forum Contributor
- Posts: 460
- Joined: Thu Apr 27, 2006 10:50 am
- Location: Ypsilanti Michigan, formally Clipsburgh
something like this?
Everah | Please use
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
<?php
$smiles = array (
option value="smile1" => ['<img src='smile1.gif'],
//et cetera?
);?>Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Code: Select all
<?php
$smiles = array('Smile', 'Laugh', 'Cry');
/**
* This generates a drop down with
* the array index as the key and
* the smilie name as the value in the form
**/
echo '<select name="smile">';
foreach ($smile as $key => $value)
{
echo '<option value="' . $key . '">' . $value . '</option>';
}
echo '<select>';
/**
* This makes a list of all images displayed
**/
foreach ($smile as $key => $value)
{
echo '<img src="/path/to/images/' . $value . '.jpg" /><br /><br />';
}
?>