Answer the question
In order to leave comments, you need to log in
How to fill a form via Python3 and send data to db?
You need to send data to the form on the site through the requests library. Then the received data is stored in a table in the database.
Here is the form code:
<form action="" method="post">
<label>Логин</label>
<input name="login" id="login" type="text"><br/>
<label>Пароль</label>
<input name="password" id="password" type="password"><br/>
</form>
if ($_SERVER["REQUEST_METHOD"] == "POST"){
$login = $_POST["login"];
$password = $_POST["password"];
$mysqli = new mysqli ("url.ru","user","password","table");
$mysqli->query("SET NAMES 'utf8'");
$succ = $mysqli->query("INSERT INTO `auth`(`login`,`password`) VALUES ($login,$password)");
echo $succ;
$mysqli->close();
import requests
data = {'login':'test', 'password':'test'}
url = 'url.ru'
requests.post(url, data)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question