<!DOCTYPE html>
<html>
<head>
<title>Data</title>
</head>
<body>
/* POST it here */
<form action="this.php" method="post">
<input type='text' name='SpouseName' required/>
<input type='text' name='SpouseAge' />
<input type="submit" name="submit" value="SUBMIT"/>
</form>
</body>
</html>
/* Here is the PHP CODE */
<?php
include 'dbh2.php';
$SpouseName = $_POST['SpouseName'];
$SpouseAge = $_POST['SpouseAge'];
$sql = "INSERT INTO test (SpouseName, SpouseAge) VALUES ('$SpouseName', '$SpouseAge')";
$result = $conn->query($sql);
?>
I want to ignore empty input like spouseage how to do it?