0

I am running an html page on apache2:

http://localhost/test.html

I want to send the username to a python script check.py, How can I do that?

html:

<div id="wrapper">

    <form name="login-form" class="login-form" action="check.py" method="post" onsubmit="validate();return false;">

        <div class="header">
        <h1>Login Form</h1>
        <span>Fill out the form below to login to my super awesome imaginary control panel.</span>
        </div>

        <div class="content">
        <input id="Uname" name="username" type="text" class="input username" placeholder="Username" />
        <div class="user-icon"></div>
        <input id="Pname"name="password" type="password" class="input password" placeholder="Password" />
        <div class="pass-icon"></div>       
        </div>

        <div class="footer">
        <input type="submit" name="submit" value="Login" class="button"/>
        <input type="submit" name="submit" value="Register" class="register" />
        </div>

    </form>
       </div>

<div class="gradient"></div>
</body>
</html>
mobykhn
  • 221
  • 1
  • 4
  • 14

1 Answers1

1

Well you are running a static page, their is no way you can pass the page data to python file this way.

What you need is to learn server side programming. In python Django and Flask are the popular framework for server side programming.

Below is a question related to flask. that will suits your need

Sending data from HTML form to a Python script in Flask

Community
  • 1
  • 1
duck
  • 2,483
  • 1
  • 24
  • 34