On Fri, 12 Nov 2004 15:41, Justin Baiocchi wrote: > I use this when submitting the data from the form (for jokes): > > if ($submit) > { > $joke = nl2br($joke); > $dbcnx = @mysql_connect( "localhost", "root", "password"); > mysql_select_db("movements"); > $sql = "INSERT INTO jokes SET author='$author', joke='$joke', id='$id'"; > mysql_query($sql); > echo "<b>Thank you, your joke has been recorded!</b>"; > } Here you are adding < /BR> to the data before storing it in the database. Note that if you want to provide the stored data for editing, the embedded HTML may confuse people who are modifying the data. Better technique is to store the text as given (after validating it for whatever things you don't want to allow) and simply use nl2br() when you display the data. > Then this when displaying the text: > > > if (!$link = mysql_connect("localhost","root","password")) > exit("Unable to make a connection to the database"); > if (!mysql_select_db("movements", $link)) > exit("Unable to select the database"); > $table = 'jokes'; > $check = "select * from $table ORDER BY rand() LIMIT 100"; > $qry = mysql_query($check) or die ("Could not match data because > ".mysql_error()); > $myrow = mysql_fetch_array($qry); This next line doesn't seem to do anything. I'm guessing that you are trying to replace the < /BR> that you added above with a newline; this is redundant and if it actually worked, would add an extra newline at each occurrence of < /BR>. Note that nl2br doesn't replace a newline, it adds the BR before each newline. > $joke = str_replace("<br />","\n",$joke); > ?> > <table border="1" bgcolor="#0D9BA4"> > <tr> > <td width="70%"><b><?echo($myrow['joke']); > ?> > </b> > </td> > <td valign="top"><b>Kindly provided by > <?echo($myrow['author']);?> </b> > </td> > </tr> > <table> > > Excuse the crap code, I'm pretty new to php :) Cheers -- David Robley Misspelled? Impossible. My modem is error correcting! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php