There is a form for adding a post in the database, everything is clear, everything works. We must also make a button to load the post in JSON format. How to implement it?
Closed due to the fact that the essence of the question is not clear to the participants Kirill Stoianov , Denis Bubnov , Alex , Grundy , Nicolas Chabanovsky ♦ 6 Dec '16 at 4:34 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- json_encode / json_decode - ilyaplot
- I know these functions. Just encode before sending to bd? - Eugen
- Yes, json_encode turns an object or array into a string. - ilyaplot
- form take fields and encode each in json? - Eugen
- I can't know, because the question is too blurry. And that podraumevatsya under loading the post in json - it is not clear. Read about json, look at examples of data in this format and everything will become clear. - ilyaplot
|
1 answer
Make a button and bind action to it. In the handler, write the request to the database, and then use the json_encode () function; The manual is attached: http://php.net/manual/ru/function.json-encode.php
|