Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8072927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:10:42+00:00 2026-06-05T14:10:42+00:00

How to get the text input given by a user for an HTML page

  • 0

How to get the text input given by a user for an HTML page through python?

e.g.

<html>
<input id="post_form_id" name="fooput" value="" />
</html>

Now, the user inputs the value abcxyz in the text field. How can I get that value using python? I already know how it is done through javascript but I want to do it using python.

Also, I already tried Beautiful Soup but it can only return the preset value of the field.
SO I can do

soup=BeautifulSoup(open("myhtmldoc.htm")) 
print soup.find('input')['value']

But this wil only give me the preset value and not the value given by the user.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:10:43+00:00Added an answer on June 5, 2026 at 2:10 pm

    You need to write a script that is called when the form is submitted. Typically, you use some framework that takes care of the sundry details.

    A lightweight framework like Flask makes this task easy:

    from flask import Flask, render_template
    
    app = Flask(__name__)
    
    app.route('/',methods=['GET','POST'])
    def print_form():
        if request.method == 'POST':
            return render_template('form.html',result=request.form['fooput'])
        if request.method == 'GET':
            return render_template('form.html')
    
    if __name__ == '__main__':
        app.run()
    

    In your form.html:

    {% if result %}
        You entered: {{ result }}
    {% endif %}
    <form method="POST" action=".">
       <input id="post_form_id" name="fooput" value="" />
       <input type="submit">
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get edit text to behave in this way: User can input
I am trying to get the value of the text in the input fields.
I am trying to get text input from the keyboard in Java 6. I
I am trying to get a input text area and a submit button attached
I have this input text and input button, I am trying to get them
I have input from Form Name,Branch (text) x,y and Total are (number) fields Record
I have a html file which select images from user's computer.code is given bellow
I was wondering how I could input a value into a form with html.
I have a html file which select images from user's computer.code is given bellow
Given the following input string: (?i:\bsys\.user_catalog\b) Stored into sqlite TEXT field. When retrieved with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.