Announcement

Collapse
No announcement yet.

Open html-tags?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Open html-tags?

    hi,

    I have this function:
    PHP Code:
    function clean_submit_data($data) {
        
    $data rtrim ($data);
        
    $data strip_tags ($data"<br><i><u><b>"); //but don't strip: <br><i>...
        
    $data nl2br ($data);
        return 
    $data//this will be stored into mySQL table!

    What should I add to this funtion, so I know that $data won't contain open html-tags (<i><u><b>)?

    My little sollution:
    PHP Code:
    function clean_submit_data($data) {
        
    $data rtrim ($data);
        
    $data strip_tags ($data"<br><i><u><b>");
        
    $data nl2br ($data);
        
        
    $error check_for_open_tags($data);
        if (
    $error == 0) {
            return 
    $data;
        } else {
            return 
    $error;
        )
    }

    function 
    check_for_open_tags($data) {
        
    $error 0;
        ????????? 
    //do something to $data.
        
    if(opentags) {
            
    $error 1;
        }
        return 
    $error;

    (Also does anyone have a good tut. about pattern matching?)
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X