Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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