Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jul 2009
    Posts
    68
    Thanks
    1
    Thanked 1 Time in 1 Post

    htmlentities help

    I'm building a little script for myself where it'll get the html from a file so it can be edited.

    This is my code:
    PHP Code:
    <?php
        
    echo "<form name=\"myform\" action=\"\" method=\"POST\">";
        echo 
    "<textarea rows=\"20\" cols=\"50\>";

        
    $str=htmlentities(file_get_contents('otherheader.php'));
        echo 
    $str;

        echo 
    "</textarea>";
        echo 
    "<input type=\"submit\" value=\"Submit\">";
        echo 
    "</form>";
    ?>
    When I take away the form bit it works however when I put the form part in it just returns </form> within the text area. How can I stop this?

    Thanks.

  • #2
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts

  • #3
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by Skippy View Post

    When I take away the form bit it works however when I put the form part in it just returns </form> within the text area. How can I stop this?

    Thanks.
    Your Code change to:

    <form name="myform" action="" method="POST">
    <textarea rows="20" cols="50">
    PHP Code:
    <?php
    //$charse='UTF-8';
    //$str=stripcslashes($str);
    $str=file_get_contents('yourpage.html/.php/.chm/.txt');
    echo 
    htmlentities($str);
    //echo htmlentities($str, ENT_COMPAT, $charset);
    ?>
    </textarea>
    <input type="submit" value="Submit">
    </form>


    Regards
    Last edited by sir.jones; 01-07-2010 at 07:11 PM.

  • #4
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    @skippy;
    Whether your code was fundamenatlly OK, I don;t know but you missed off your closing " on line 2 in your OP.

    Code:
     echo "<textarea rows=\"20\" cols=\"50\>";
    should have been

    Code:
     echo "<textarea rows=\"20\" cols=\"50\">";
    I would try sir.jones code though since it seems to make more sense to me.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Bazz is right. Fix your php.
    PHP Code:
    echo "<textarea rows=\"20\" cols=\"50\">"
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts
    From 1st time i look Skype code i kown him/her missed close with " at cols=\"50\" but my code model able to avoid it.

    that's mean someone save his/her time if work with thousand html tags line

  • #7
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts
    From 1st time i look Skippy code i kown him/her missed close with " at cols=\"50\" but my code model able to avoid it.

    that's mean someone save his/her time if work with thousand html tags line


  •  

    Posting Permissions

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