www.webdeveloper.com
Results 1 to 11 of 11

Thread: Problem passing html thru url

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Posts
    9

    Question Problem passing html thru url

    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:

    HTML Code:
    %3CIMG+src%3Dimages_dir%2Flady%2Fimage_url.jpg%22+width%3D154+height%3D140%3E%3CBR
    And that makes it not working.
    When i change the url to this:

    HTML Code:
    %3CIMG+src%3Dimages_dir%2Flady%2Fimage_url.jpg+width%3D154+height%3D140%3E%3CBR
    Then it works, so what i did was to remove the %22 after the image url.

    Is there a way to remove the %22 automaticly for each submit of the get form, or is there another way to pass html thru get?

    I'm up for using either PHP, HTML or JAVSCRIPT to solve this one.

    Hope someone knows a slolution else then changeing form to post, as post will not make it work with the rest of my script.


    norNerd

  2. #2
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    The &#37;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:
    Code:
    newStr=str.replace("\"","");
    54 68 65 42 65 61 72 4D 61 79

  3. #3
    Join Date
    Jan 2009
    Posts
    3,346
    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.

  4. #4
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    I use this:
    PHP Code:
    $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 

  5. #5
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    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 

  6. #6
    Join Date
    Nov 2009
    Posts
    9

    Lightbulb Thanks people

    Hi, thanks all for setting some ideas into my head..

    I added this to my code

    PHP Code:
    elseif($_GET['delete_img2']){
        
    $content_name    $_GET['content0'];
        
    $content_dag    str_replace("/\%22/"" "$_GET['content1']);
        
    $content_dag    urldecode($content_dag);
        
    $content_dag    str_replace("&lt;""<"$content_dag);
            
    $content_dag     str_replace("&gt;"">"$content_dag);
        
    $content_natt    "";
        
    $content_kladd    $_GET['content3'];
        
    $postable        "true";

    And now my problem is getting closer to be solved
    HTML Code:
    <img src="%5C%22images_dir/lady/image_url.jpg%5C%22" width="154" height="140">
    thats what i have now, so the html is sent
    sucessfully, but im still not removing %22 and %5C showed up there to.

    What can i do now ?

    and thanks again

    kris

  7. #7
    Join Date
    Nov 2009
    Posts
    9
    When adding <img and > in the echo/print
    url turned out like this again:

    HTML Code:
    <img src="&#37;5C%22produkter_org/man/produkter_man_level1.jpg%5C%22" width="150" height="140">
    So that dident work so well at all
    Then im stuck again, so anyone out there with an idea?

    Kris

  8. #8
    Join Date
    Sep 2008
    Location
    Mexico
    Posts
    786
    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.
    ...but stupidity is terminal.

  9. #9
    Join Date
    Nov 2009
    Posts
    9
    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".

    need some more description?

    Kris

  10. #10
    Join Date
    Sep 2008
    Location
    Mexico
    Posts
    786
    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....
    ...but stupidity is terminal.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles