Trying to insert input from show/hidden element form using radio button

javascript
#1

Here is the full story, I a making a reservation form and have a hidden form using radio button javascript. If the user checked ‘Yes’, it shows the hidden form and if not, just submit the form by clicking the submit button. My main problem is, how do I insert the all the data if the user checked ‘Yes’ and if the user checked ‘No’, how do I insert some some of the data in database. I have no error for now because it display blank page.

Here is some code:

<!--     Requisition -->
<div class="form-group">
	<label class="col-sm-2 control-label">Purpose of requisition : <span style="color:red">*</span></label>
		<div class="col-sm-10">
			<textarea class="form-control" name="purpose" rows="3" style="width: 31em;" required></textarea>
		</div>
</div>
    
    <br>
    
        <!--Additional Information-->
    <!-- Radiobutton -->
     <label class=""> Do you require a non-company driver?</label>
        <div class="Radiobutton">
            <input type="radio" name="pick" onchange="showAduan(this)" value="complaint" class=" control-label">Yes
            <input type="radio" name="pick" onchange="showPermintaan(this)" value="request" class=" control-label">No
        </div> 
        <br>
        <div  id="complaint" style="display: none">
<h4>Driver Information (if not company driver)</h4>
        
        <br>
     <div class="form-group">
        <label class="col-sm-2 control-label">Name:</label>
        	<div class="col-sm-4">
            	<input class="form-control" type='text' id='yes' name='driverName' <?php echo $_POST['driverName']; ?>>
          	</div>

        <label class="col-sm-2 control-label">Employee No:</label>
        	<div class="col-sm-4">
            	<input class="form-control" type='text' id='yes' name='driveremployeeNo'<?php echo $_POST['driveremployeeNo']; ?>>
     		</div>
     </div>

	 <div class="form-group">
        <label class="col-sm-2 control-label">Position:</label>
        	<div class="col-sm-4"> 
            	<input class="form-control" type='text' id='yes' name='driverPosition' <?php echo $_POST['driverPosition']; ?>>
            </div>

        <label class="col-sm-2 control-label">Department:</label>
        	<div class="col-sm-4">
            	<input class="form-control" type='text' id='yes' name='driverDepartment' <?php echo $_POST['driverDepartment']; ?>>
        	</div>
     </div>
        
     <div class="form-group">
        <label class="col-sm-2 control-label">Expiry date of license(D): </label>
        	<div class="col-sm-4">
            	<input class="form-control" type='text' id='acc' name='expiredLicense' <?php echo $_POST['expiredLicense']; ?>>
        	</div>
     </div>
        </div>
          <!--//////////////////////////-->

         <div  id="request" style="display: none">
        <!--empty form-->
        </div>
          
<div class="form-group">
	<div class="col-sm-8 col-sm-offset-2">
		<button class="btn btn-primary" name="submit" type="submit" style="font-size: 15px;">Confirm reservation</button>
	</div>
</div>  
      </form>

Here is some database code:

if (isset($_POST['drivername']) && $_POST['drivername'] == false){
....
}

elseif (isset($_POST['drivername']) && $_POST['drivername'] == true){
...    
}

I cannot post the full database code because for some reason this page doesn’t put it in order and it is hard to read. If any of you know how to post, please help. Thank you

#2

Frist thing is to enable error reporting on your development machine

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

If that doesn’t help you have to go into the error log of your server, your hoster can tell you how to do.

Otherwise i don’t see the problem, just use if-then-else

if($saidYes){
 $stmt = $pdo->prepare('insert into foo(some, bar) values(?,?)');
 $stmt ->execute([$some, $bar]);
}
else{
 $stmt = $pdo->prepare('insert into foo(some) values(?)');
 $stmt ->execute([$some]);
}
#3

Surround your code with three backticks , or use the </> icon at the top of the reply box to mark it as plain text.

As @chorn said above, check the value of the radio button and run the appropriate query.