Jump to content

HTML code input from form problems


legacyblade

Recommended Posts

Hello. My employer contracted me to make a web script that replaces certain items of text in an HTML document (the name, contact e-mail, etc). It's all very well and good, and functioning. Except for one error I didn't realize until the final testing.

 

One thing that my script is replacing is a bit of the HTML code for an e-mail optin form. The script passes no errors when HTML is given to it as a string, but it refuses to replace properly. After some experimenting, I found that the problem is this: anything after a < doesn't show up in a string. Anything else (even ',",\ or other special characters) show up just fine as a character in the string. But anything after the first instance of a < is not included in the string (and when the whole string is HTML code, that doesn't work very well). I've even tried passing \<, but that just makes the value of the string "\".

 

Does anyone know how to get around this problem?

Link to comment
Share on other sites

bump. I still have a problem. I'd try replacing every instance of < in the string with <, but that character ends the string. < and anything after it are considered not in the string. So I'm not quite sure how to go about fixing it.

 

I'm getting the input from a textarea that's being submitted via ah html form. Any suggestions?

Link to comment
Share on other sites

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.