I have some forms submitting to my db table without hiccups but the data within the forms is not. Thus, new rows are generated but they are blank. I am using MAMP (Mac Apache MySQL PHP) stack in local development.
This is the end of my html page to give an example. I've included my email form and submit button.
<div class="col-md-4">
<div class="div1">
<h2>Step 6</h2><p>Email: REQUIRED </p>
<form action="upload_file.php" method="post">
<input type="text" id="email" name="email" class="form-control" placeholder="kookmeyer@gmail.com"></br>
</form>
</div>
</div>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-4">
<div class="submit">
<form action="upload_file.php" method="post">
<button type="submit" class="btn btn-primary btn-lg btn-block" name="submit" >Submit</button>
</form>
</div> <!--End div col-md-5-->
</div> <!--End div Submit-->
The php page (upload_file.php) is,
<?php
//connecting to db
$dbc = mysqli_connect('localhost', 'root', 'root', 'surfboardhub')
or die('Error connecting to MySQL server');
//Get values from
$email = "";
$brand = "";
$model = "";
$height ="";
$width = "";
$thick = "";
$price = "";
$location = "";
if(isset($_POST['location'])){ $location = $_POST['location']; }
if(isset($_POST['price'])){ $price = $_POST['price']; }
if(isset($_POST['thick'])){ $thick = $_POST['thick']; }
if(isset($_POST['width'])){ $width = $_POST['width']; }
if(isset($_POST['height'])){ $height = $_POST['height']; }
if(isset($_POST['model'])){ $model = $_POST['model']; }
if(isset($_POST['brand'])){ $brand = $_POST['brand']; }
if(isset($_POST['email'])){ $email = $_POST['email']; }
$query = "INSERT INTO uploads (brand, model, height, width, thick, price, location, email)
VALUES ('$brand', '$model', '$height', '$width', '$thick', '$price', '$location', '$email')";
$result = mysqli_query($dbc,$query)
or die('Error querying database.');
mysqli_close($dbc);
echo 'Thanks for submitting your stick! An email has been sent to you with a link to your ad!<br />';
echo 'Clicking here will send you back to the homepage';
?>
Any help is much appreciated. Thanks in advance!!! Dan