Jump to content

[SOLVED] Explain this code to me please


acctman

Recommended Posts

Hi can someone explain the IF statement below too me? I kind of understand whats going on, it's looping though the post and i think its stripping HTML tags if present from the values..., am I correct? I don't get the "allowed_html" at the end.

 

Also the second IF statement has two ";" at the end, which i've never seen done before is that just an error?

 

thanks in advance

 

    if (is_array($_POST['add']))
        foreach ($_POST['add'] as $key => $value) $_POST['add'][$key] = strip_tags(stripslashes($value),allowed_html);

    if (is_array($_POST['edit_add']))
        foreach ($_POST['edit_add'] as $key => $value) $_POST['edit_add'][$key] = strip_tags(stripslashes($value),allowed_html);;

Link to comment
https://forums.phpfreaks.com/topic/124074-solved-explain-this-code-to-me-please/
Share on other sites

Double ;; is just a typo. It's not even an error.

 

Now for this allowed_html thing.

strip_tags() function has two arguments. One is a string in which tags are to be removed.

Second one is optional, and it describes tags, that should be left in processed string.

 

Check if you have a constant called allowed_html defined somewhere before that code.

Double ;; is just a typo. It's not even an error.

 

Now for this allowed_html thing.

strip_tags() function has two arguments. One is a string in which tags are to be removed.

Second one is optional, and it describes tags, that should be left in processed string.

 

Check if you have a constant called allowed_html defined somewhere before that code.

 

thanks. there is no constant above the code for allow_html. i understand now how to edit the coding now

Archived

This topic is now archived and is closed to further replies.

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