All a bit new to HTML, PHP and phpMyAdmin link up. Was having trouble sending form information from HTML to PHP.
My HTML code Login.html:
<form role="form" action="insert.php" method="post">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="fn" id="fn" class="form-control input-sm" placeholder="First Name">
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" name="ln" id="ln" class="form-control input-sm" placeholder="Last Name">
</div>
</div>
</div>
<div class="form-group">
<input type="location" name="loc" id="loc" class="form-control input-sm" placeholder="Location">
</div>
<div class="form-group">
<input type="email" name="email" id="email" class="form-control input-sm" placeholder="Email Address">
</div>
<div class=" form-group">
<h4 >Gender</h4>
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female
</div>
<input type="submit" value="Register" onClick="signup();" class="btn btn-info btn-block">
</form>
My PHP code insert.php
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "1234";
$db = "client";
/*
$first=$_GET("fn");
$last=$_GET("ln");
$location=$_GET("loc");
$email=$_GET("email");
*/
$connect = mysqli_connect($dbhost,$dbuser,$dbpass, $db);
mysqli_query($connect, "insert into client () values($_POST[fn]', '$_POST[ln]', '$_POST[email]', '$_POST[loc]')");
/*mysqli_query($connect, "insert into client values('user','name','afggei@ggwp.com','tumbartk')"); */
?>
The Error I receive:
Notice: Undefined index: fn in C:\xampp\htdocs\marion\insert.php on line 14
Notice: Undefined index: ln in C:\xampp\htdocs\marion\insert.php on line 14
Notice: Undefined index: email in C:\xampp\htdocs\marion\insert.php on line 14
Notice: Undefined index: loc in C:\xampp\htdocs\marion\insert.php on line 14
The connection does establish and work as I've tested the below code.
mysqli_query($connect, "insert into client values('user','name','afggei@ggwp.com','tumbartk')");