Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Error When Trying To Install Smilies In Guestbook
Old 08-15-2007, 12:30 PM Error When Trying To Install Smilies In Guestbook
Junior Talker

Posts: 4
Trades: 0
Hi there. I'm trying to add smilies to a guestbook script. I have successfully used the same smiley script several times in other guestbooks but for some reason can't get it to work with this one. Below is the code I am using:

Code:
echo "\n".'<form method="post" action="'.SELF.'?func=sign" name="smile">
    
<script type="text/javascript">
<!--
function addsmiley(code)
{
var pretext = document.smile.message.value;
this.code = code;
document.smile.message.value = pretext + code;
}
//-->
</script>

<img src="image/smile/angel.gif" alt="image" onClick="addsmiley(':angel:')"/>&nbsp;    
    
<textarea name="mesg" id="mesg" cols="20" rows="4">'.$mesg.'</textarea><br/><input type="submit" name="submit" value="Add" /></p></form>';
This produces the following error:

Parse error: parse error, unexpected ':', expecting ',' or ';'

Any help would be much appreciated!
saneless is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-15-2007, 12:40 PM Re: Error When Trying To Install Smilies In Guestbook
Skilled Talker

Posts: 62
Name: Daniel
Trades: 0
instead of that, try using a php break.

where you would have replace everything from 'echo' to ';' with this and see how it works.

PHP Code:
?>
<form method="post" action="<?=SELF ?>?func=sign" name="smile">
    
<script type="text/javascript">
<!--
function addsmiley(code)
{
var pretext = document.smile.message.value;
this.code = code;
document.smile.message.value = pretext + code;
}
//-->
</script>
<img src="image/smile/angel.gif" alt="image" onClick="addsmiley(':angel:')"/>&nbsp;    
    
<textarea name="mesg" id="mesg" cols="20" rows="4"><?=$mesg ?></textarea><br/><input type="submit" name="submit" value="Add" /></p></form>
<?
castis is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 12:52 PM Re: Error When Trying To Install Smilies In Guestbook
Junior Talker

Posts: 4
Trades: 0
Thank you SO much! That worked perfectly!
saneless is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 01:07 PM Re: Error When Trying To Install Smilies In Guestbook
Skilled Talker

Posts: 62
Name: Daniel
Trades: 0
not a problem!

at the same time, do you understand how it works?
castis is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 01:24 PM Re: Error When Trying To Install Smilies In Guestbook
Junior Talker

Posts: 4
Trades: 0
Not really, lol. I don't know a whole lot about PHP but seem to be able to manipulate scripts to do what I want :-P
saneless is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 01:30 PM Re: Error When Trying To Install Smilies In Guestbook
Junior Talker

Posts: 4
Trades: 0
Ah. One more question. It works great for showing the smilies but it doesnt show the smiley code in the textarea when I edit a post. Any idea why?
saneless is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 04:04 PM Re: Error When Trying To Install Smilies In Guestbook
Skilled Talker

Posts: 62
Name: Daniel
Trades: 0
first off; what i showed you is a php break. it tells the php engine to stop parsing php and just throw out html.

PHP Code:
<?=$var ?>
is the same as

PHP Code:
<?php
echo $var;
?>
it just makes it a little easier.

what does it show when you edit a post? something else or nothing at all?

Last edited by castis; 08-15-2007 at 04:04 PM.. Reason: oops
castis is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Error When Trying To Install Smilies In Guestbook
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34649 seconds with 12 queries