Jump to content

Hello everyone! help with syntax error


niiki-lou

Recommended Posts

Hello all, im writing a chatbox script ive managed to get everything working fine up untill now when ive tried to add some BBcode tags stuff in there, my problematic code is below,

 

When i add this in above my text area that requires the bbcodes it just gives me a

 

Parse error: syntax error, unexpected '[' in /home/nikki-lou/public_html/shoutbox.php on line 183

 

<a title="Bold : [b ][/b ]" onmousedown="addTags('[b ]','[/b ]')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a>
<"smily" title="[ ]" onmousedown="addText('[ ]')">

 

Can anyone shed some light on this for me please ? im still learning with this and its been alot of fun up untill now :)

Link to comment
Share on other sites

 

No problem, every one starts somewhere. On php pages you will have some tags that look like this

<?php

?>

 

That shows where php code is. If those lines are within those tags you need to use echo to output them to the screen

 

<?php
echo 'Something to output';
?>

 

so for that string it will looks something like

<?php
echo '<a title="Bold : [b ][/b ]" onmousedown="addTags(\'[b ]\',\'[/b ]\')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a>';
?>

 

 

with the '[b ]' bits you need to escape the ' marks to stop it from breaking the string, and you do that with \.

 

Hope this helps, if not post your code, it will probable help give us a clearer example of what you are trying to do

Link to comment
Share on other sites

Hello Jibberish thansk for the break down / explanation it helped e to understnad this in a better way but im still getting my errors and im very unsure why

 

Parse error: syntax error, unexpected T_STRING in /home/phpcorec/public_html/pm/compose.php on line 125

 

$contentOutput .='
<form name="send" method="post" action="index.php?page=messages&option=new">
<table width="80%">
<tr>
<td width="150px" align="left" valign="top"><p>Username</p></td>
<td width="" align="left" valign="top"><input name="username" id="username" value="' . $_GET['user'] . $receiver . '" readonly="readonly"></td>
</tr>

<tr>
<td width="150px" align="left" valign="top"><p>Subject</p></td>
<td width="" align="left" valign="top"><input name="subject" type="text" id="subject" value="' . $subject . '"></td>
</tr>

<?php
// THIS IS LINE 125 echo '<a title="Bold : [b ][/b ]" onmousedown="addTags(\'[b ]\',\'[/b ]\')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a>';
?>

<tr>
<td width="150px" align="left" valign="top"><p>Message Body</p></td>
<td width="" align="left" valign="top"><textarea name="message" type="text" id="message" value="" cols="50" rows="10"></textarea></td>
</tr>

<tr>
<td><input type="hidden" name="unread" value="' . $unread . '"></td>
</tr>


<tr> 
<td></td>
<td><input type="submit" name="Submit" value="Send Message"></td>
</tr>
</table>
</form>';
}
?>

Link to comment
Share on other sites

Tons of problems in this 1st your trying to echo out inside a table code look into </td> and </tr> of a table.

</tr> table is still running this unless you output inside the <td>OUTPUT</td> your have problems on the rending side of html.

 

Next error

You have the STRING  $contentOutput  which means this page is already have a PHP start at the top maybe so you do not need to start it again.

 

Last problem

You look to be editing someones code and if this was done by a professional this would more then likely be an return therefore this will make problems trying to echo inside a return as it will just echo outside the top of the page and also maybe a session error, therefor you need to follow his logic with the personal code.

 

I recommend finding the end of that table which shown as </table> and then add a new line after the "';"

 

$contentOutput .= '<a title="Bold : [b ][/b ]" onmousedown="addTags(\'[b ]\',\'[/b ]\')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a>';

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.