Sending the contents of an iframe to php


I want to send the data of an iframe to a PHP script. I searched everywhere but I can’t find how should I send the data.


Um, why?



What is the REAL problem you are trying to solve, not your attempt at solving it?


I am rendering the user input data to an iframe. But I also want to store the user input as text files. So I want to send the contents of the iframe to php.


Is there a form in the I-frame?


The iframe is inside a form like this:


And the only way I can see a need for this is for spoofing a site and trying to collect the information entered. If this is your form, you WOULD NOT need an iframe to get values from anything.


I need this because I am making an online live HTML preview app. The user will enter the code and would see the results instantly. I have made it work. But I think I should make a way so that the user could save what they have written. For this, I want to send the contents of the iframe to PHP so that the server would store the code that the user has entered and can retrieve it whenever required.


That still doesn’t make sense. You wouldn’t need to store the iframe contents if they entered code into an input that the iframe uses. Try again.


Yes, you are right, I should store the code that the user enters in the input area rather than storing the iframe. I think this should do my job. Thanks!