Легкий пример:
<?php
$host=''; //define host
$user='xxx'; //define username
$pass='xxx'; //define password
$db_name='xxx'; //define db name
$db = new mysqli($host, $user, $pass, $db_name);
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if(isset($_POST['status'])) { //code called when user sent form
$status = mysqli_escape_string($db, ($_POST['status']));
//same way to save other fields, just rename "status" to your value
$sql = "INSERT INTO /* table name here */ (status, /* define other line in DB here */) VALUES ('$status', /* define other variables to save here */)"; //save into database, see the example below
//example: $sql = "INSERT INTO mydatabase (status, email, name) VALUES ('$status', '$email', '$name')";
if ($db->query($sql) === TRUE) {
echo "Saved.";
}
else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
?>
<form enctype="multipart/form-data" action="<?php $_PHP_SELF ?>" method="POST">
<label for="status">Status: </label>
<input id="status" name="status" value="" />
//add other fields here, just rename "status" to your value
<input type="submit" name="submit" value="Send form" /></form>
Это может быть то, что вы ищете, просто адаптировать его самостоятельно.
Вы можете указать значение trouch $ _POST или указать имя тега textfield в качестве примера. –
У вас есть пример –
Стандартная реакция: Что вы сделали до этого времени? –