We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28309
    • 12 Posts
    I have created a form with a textarea and a submit button.
    Within a text area i put some thing like this

    <script language="javascript" src="http://somesite.com/abc/myfile.php"></script>

    now my form is some thing like this

    <form name="form1" method="post">
    <textarea name="abc">
    <script language="javascript" src="http://somesite.com/abc/myfile.php"></script>
    </textarea>
    <input type="submit" value="submit"/>
    </form>

    then i submit the form.

    I write the code $abc=$_POST[’abc’];
    echo $abc;


    it must be inserting an script at echo position.
    but the value i got is blank.

    when i tried any other text its working fine.

    What is the problem and how to rectify it.






      • 7455
      • 2,204 Posts
      I think that you need to escape the " and / to make it work
      maybe this works for you?

      $abc=addslashes($_POST['abc']);
      echo striplashes($abc);
      


      but allowing things like this creates a big security risk. you do not check the input for any code that could give people the option to run code on your website. Maybe even use XSS to gain access to your server.

      Dimmy
        follow me on twitter: @dimmy01
        • 28309
        • 12 Posts
        Thanks,
        Your  Suggestions Works.

        Their is one another way i found is tweaking the modx code which escapes the script tag from the request.