I'm trying to collect form data with html and php and it seems to work for everyone but iphone users, which provide blank data. Any help would be MUCH appreciated! I've copied the first two questions.
index.php
<form action="report.php" method="post" id="questions" target="_blank">
<div class="form-group">
<label for="q0101">What's your first name?</label>
<br>
<textarea id="q0101" name="q0101" required class="form-control" rows="1"
placeholder="e.g., Chris"></textarea>
</div>
<div class="form-group">
<label for="q0102">What's your last name?</label>
<textarea id="q0102" name="q0102" required class="form-control" rows="1"
placeholder="e.g., Richardson"></textarea>
</div>
report.php:
<?php
$hostname = "localhost";
$username = "___";
$password = "___";
$dbname = "___";
$conn = new mysqli( $hostname, $username, $password, $dbname );
if ( $conn->connect_error ) {
die( "Error: Failed to connect." );
}
$q0101 = mysqli_real_escape_string( $conn, $_POST[ 'q0101' ] );
$q0102 = mysqli_real_escape_string( $conn, $_POST[ 'q0102' ] );
$sql = "INSERT INTO ___ (first_name, last_name) VALUES (?,?);";
$stmt = mysqli_stmt_init( $conn );
if ( !mysqli_stmt_prepare( $stmt, $sql ) ) {
echo "Error submitting responses";
} else {
mysqli_stmt_bind_param( $stmt, "ss", $q0101, $q0102 );
mysqli_stmt_execute( $stmt );
echo "Responses successfully submitted! <br/>";
echo 'What is your first name? <br />';
echo $q0101 . '<br />';
echo 'What is your last name? <br />';
echo $q0102 . '<br />';
}
$conn->close();
?>