I need help. I want to pass variables from html 5 form to python code. I found it can be done with django but it is recommended that I use html and javascript. Any help please!
Asked
Active
Viewed 127 times
0
-
1you can use Django website tutorial docs understand working process. – gaurav Jun 13 '21 at 07:21
-
@gaurav I have to use html and javaScript not Django – mh mr Jun 13 '21 at 07:22
-
With html and javascript, it is not possible to send data to your python script – Sanket Vyawahare Jun 13 '21 at 07:23
-
what about java ? @SanketVyawahare – mh mr Jun 13 '21 at 07:25
-
1Does this answer your question? [Posting html form values to python script](https://stackoverflow.com/questions/15965646/posting-html-form-values-to-python-script) – Olvin Roght Jun 13 '21 at 07:25
-
1@SanketVyawahare, it is. – Olvin Roght Jun 13 '21 at 07:25
-
Why you want to go into complexity? if you want to send data to python, then use python at backend. Its is not tough. Flask can do it for you in very less time. – Sanket Vyawahare Jun 13 '21 at 07:26
-
html and JS is client side so when you want to pass variable python mean server side you have to use some framework or library to do that if Django is not necessary then i would suggest to you Flask framwork in python . now why would you want to send variable to python or java ? – gaurav Jun 13 '21 at 07:27
-
We will open HTML in browser... Browsers won't provide a RE for python. So You need to make your python code to be listening on some port over over http... To do that you can simply use http.server module. Instead you can use other popular web frameworks like django, fastapi, flask and many more which provides all boiler plates abstracted into simple options/functions/configuration. After making your you python code listening on some host you can do simple form submit and Ajax request from your Html – Karthikeyan Jun 13 '21 at 07:33
-
@OlvinRoght when I follow this example ,I get entire code of python in the browser when I click the submit button – mh mr Jun 13 '21 at 07:43