Hi people, i got a sort of big problem, wich i actually think will be solved with just a little line of code either in html, javascript or php.
But i have no idea at all what i can do to solve it by my self.
So here it goes,
On my index.php i got four textareas, two is regular, the other two has WYSIWYG editors attached to it.
The two regular contains only:
My Name etc and Some other text the user wants to write.
The two with WYSIWYG editors attached are used to post images, and the form data as in the image is visually shown as a image, but behind the scenes in the WYSIWYG editor its like this:
<img src="" height="" width="" alt="" />
As in regular html code.
I _need_ to pass this once before saveing, and i must pass the html thru get function, or my whole script fails.
But when i pass it, it goes into urlencode i think, and it adds a little "%22" somewhere in my code that makes it look like this:
The %22 is a double quote ("), but if you can't find where you are inserting it you should be able to get rid of it using the string.replace() function in javascript. Before the urlencode assuming str contains the text string you are getting ready to send the code would look something like:
If you are possibly sending large amounts of data it would be much easier to use POST. Then you won't have to worry about url_encode or url_decode on the server-side at all.
$who = str_replace('/\%20/', ' ', $who); //This strips out the %20 you asked for
$who = ereg_replace("[-]", " ", $who); //This removes any dashes
$who = urldecode($who); //This will remove any + signs
on another note, to replace any of those things to re-insert in your search string... you can do this:
PHP Code:
$search = ereg_replace("[-]", " ", $search); // This will remove dashes
$search = urlencode($search); // This will encode the URL (replace spaces with + signs
So as you see, this function wirdly removed the characters i wanted to remove, and it removed %5C%22, but it added slashes..
And ofcourse i cant show the image when <img and \"> is missing..
So cant use this in any tricky way can i?
Or wait, got a little idea while i wrote this, maybe i chould set <img and \">
as a default inside the elseif somewhere, then the only thing i need to do is echo/print the content of content_dag inside the <img and \> etc?
Or will this not work?
Might test it before someone replies but happy if someone helps
I must be missing something in this thread.... where are these characters coming from to start with??? I didn't see that addressed in the posts (or I missed it somehow).
I would eliminate the "problem at it's source instead of trying to fix it after the fact... just a thought.
I cant post my whole code here, as its not small or understandable at all, but ill give you the important things:
HTML Code:
<form name="my_form" method="get" action=""><textarea name="content1" id="content1">
This is the textarea with a name
</textarea><textarea name="content2" id="content2">
This is the textarea with a WYSIWYG editor attached. and it contains a image, with html code no [img] or anything
</textarea><textarea name="content3" id="content3">
This is also a textarea like the other one content2
</textarea><textarea name="content4" id="content4">
This is just like content1 only with a bit more text
</textarea></form>
So the thing is that i have to update the content of either content2 or content3 without tuching the rest on a refresh.
I solved that by echoing the content after i sent it to URL, but that gave me the issue i need help with, like sending html thru url and decodeing it
to be "showable".
Are you using a standard pre-written WYSIWYG editor? which one?
or one that you put together?
The editor is adding the characters - why? We can only find out seeing that part of the editor... if it is one that everybody has access to it's easy enough to check. If it's not the editor, then it's in the file that you are using to process the output of the editor....
Bookmarks