i have the following code
<?
include ('../inc/db.php');
include ('bb2html.php');
// Define post fields into simple variables and add some slashes
$teacher=$_POST['teacher'];
$topic=$_POST['topic'];
$date=$_POST['date'];
$bbtext = $_POST['notes'];
$teacher = addslashes($teacher);
$topic = addslashes($topic);
$date = addslashes($date);
/* Do some error checking on the form posted fields */
if((!$date) || (!$notes)){
echo 'You did not submit the following required notesrmation! <br />';
if(!$date){
echo "The date is a required field. Please enter it below.<br />";
}
if(!$bbtext){
echo "Notes is a required field. Please enter it below.<br />";
}
include 'postnotes.php'; // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
exit(); // if the error checking has failed, we'll exit the script!
}
/* well lets make the BBCode into html. Its easier for the user to do [b] insted of <b> or [url]blah[/url] insted of <a href="balh">blah</a> */
$notes = bb2html($bbtext);
/* Lets strip some slashes in case the user entered
any escaped characters. */
$bbtext = addslashes($bbtext);
/* Time to add the line breaks to the notes */
nl2br($notes);
/* Everything has passed both error checks that we have done.
It's time to add the notes! */
// Enter notes into the Database.
$notes2 = htmlspecialchars($notes);
$sql = mysql_query("INSERT INTO notes (teacher, topic, date, notes)
VALUES('$teacher', '$topic', '$date', '$notes2')") or die (mysql_error());
if(!$sql){
echo 'There has been an error adding your notes. Please contact the webmaster.';
} else {
echo 'Your class notes were added. Thanks and continue using this service';
}
?>
well when i run it i get the error and it is included in this page
bb2html.php
<?php
/*A simple FAST parser to convert BBCode to HTML
Trade-in more restrictive grammar for speed and simplicty
Syntax Sample:
--------------
[img]http://elouai.com/images/star.gif[/img]
[url="http://elouai.com"]eLouai[/url]
[mail="webmaster@elouai.com"]Webmaster[/mail]
[size="25"]HUGE[/size]
[color="red"]RED[/color]
[b]bold[/b]
[i]italic[/i]
[u]underline[/u]
[list][*]item[*]item[*]item[/list]
[code]value="123";
John said yadda yadda yadda
(please do not remove credit)
author: Louai Munajim
website: http://elouai.com
date: 2004/Apr/18
*/
function bb2html($text)
{
$bbcode = array("<", ">",
"
",
"
",
"", "",
"", "",
"", "",
'[color="', "[/color]",
"[size=\"", "[/size]",
'[url="', "[/url]",
"[mail=\"", "[/mail]",
"
", "
",
"
",
'"]');
$htmlcode = array("<", ">",
"<ul>", "<li>", "</ul>",
"<img src=\"", "\">",
"<b>", "</b>",
"<u>", "</u>",
"<i>", "</i>",
"<span style=\"color:", "</span>",
"<span style=\"font-size:", "</span>",
'<a href="', "</a>",
"<a href=\"mailto:", "</a>",
"<code>", "</code>",
"<table width=100% bgcolor=lightgray><tr><td bgcolor=white>", "</td></tr></table>",
'">');
$newtext = str_replace($bbcode, $htmlcode, $text);
$newtext = nl2br($newtext);//second pass
return $newtext;
}
?>[/CODE]
so it is saying that there is an unexpected t_string on line 2. of that page right above this.
so i am wondering what is wrong.