General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 4th, 2003, 02:46 PM
Coopercentral Coopercentral is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 Coopercentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Coopercentral
Coding problem

Hi:

On my site, I'm creating a tutorials system. I have this set of code, where after I submit from a textarea, right before I insert the data into a database, I use some ubb code. I say, the text surrounding: [table], [/table], should be replaced by the text in highlight_string($text); Here's the problem. In my code, the textarea name is $msg. I do this: $msg = nl2br($msg); But, within the [table], if I press enter, to do some PHP code, it shows the code, plus, it shows the <br />, as well as it skips the lines. I want it so that it shows no <br />, just skips the lines. My code is below:

PHP Code:
<?php

if(!$submit) {

    echo 
"<form method=\"POST\" action=\"$PHP_SELF\">
    <textarea name=\"msg\" cols=\"25\" rows=\"10\"></textarea>
    <input type=\"submit\" name=\"submit\" value=\"submit\">"
;

} else if(
$submit && !empty($msg)) {

    
$msg nl2br($msg);
    
$msg stripslashes($msg);
     
preg_match_all("/\[table\](.*?)\[\/table\]/si",$msg$outPREG_PATTERN_ORDER);
    for(
$i=0;$i<count($out[0]);$i++)
    {        
       
$msg=str_replace($out[0][$i], "<table bgcolor=\"#cccc99\" cellpadding=\"3\" cellspacing=\"0\" border=\"1\"><tr><td>".highlight_string($out[1][$i], true)."</td></tr></table>"$msg);
    }
    
    echo 
$msg;

}

?>


Thanks for all the help you may give to me on this topic!!

Ken Cooper

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Coding problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT