Submit a form?

I have a form


<div id="edit_circuit_breaker" class="overlay">
	<div class="popup" style="width:50%">
		<div class="content">
	  <a class="close" href="#">&times;</a>
			<div class="card">
			  <h3 class="card-header"><span class="icon-pencil"></span>&nbsp;&nbsp;Edit Circuit Breaker</h3>
				<div class="card-body">
					<div class="alert alert-light border border-light shadow-sm" role="alert">
					  <form action="position_circuit_breaker.php" method="POST">
						<div class="form-row">
							<div class="form-group col">
							  <label for="Manufacturer">Manufacturer</label>
							  <input type="text" class="form-control" id="Manufacturer" name="Manufacturer" value="Dell">
							</div>
							<div class="form-group col">
							  <label for="Model">Model</label>
							  <input type="text" class="form-control" id="Model" name="Model" value="4210">
							</div>
							<div class="form-group col">
							  <label for="Phase">Phase</label>
								<div class="input-group">
									<div class="input-group-prepend">
									  <span class="input-group-text">#</span>
									</div> 
								 <select class="form-control" id="Phase" name="Phase">
								  <option value="2">2</option>
								  <option value="1">1</option>
								  <option value="2">2</option>
								  <option value="3">3</option>					  
								  </select>
								</div>
							</div> 
						</div> 
						<div class="form-row">
							<div class="form-group col">
							  <label for="Voltage">Voltage</label>
								<div class="input-group">
									<div class="input-group-prepend">
									  <span class="input-group-text">#</span>
									</div> 
								  <input type="number" class="form-control" id="Voltage" name="Voltage" required value="4">
									<div class="input-group-append">
									  <span class="input-group-text">Volts</span>
									</div> 
								</div>
							</div>
							<div class="form-group col">
							  <label for="Poles">Poles</label>
								<div class="input-group">
									<div class="input-group-prepend">
									  <span class="input-group-text">#</span>
									</div> 
								  <select class="form-control" id="Poles" name="Poles">
								  <option value="2">2</option>
								  <option value="1">1</option>
								  <option value="2">2</option>
								  <option value="3">3</option>					  
								  </select>
								</div>
							</div>
							<div class="form-group col">
							  <label for="amp_rating">Rating (Required)</label>
								<div class="input-group">
									<div class="input-group-prepend">
									  <span class="input-group-text">#</span>
									</div> 
								  <input type="number" class="form-control" id="amp_rating" name="amp_rating" required value="6">
									<div class="input-group-append">
									  <span class="input-group-text">Amps</span>
									</div> 
								</div>
							</div>
						</div>
						<div class="form-group">
						  <label for="Notes">Notes</label>						  
						  <textarea class="form-control" id="Notes" name="Notes" rows="3">None</textarea>
						</div>	
						<div class="form-group">
						  <button class="btn btn-outline-dark btn-block btn-lg" type="submit">Next&nbsp;&nbsp;<span class="icon-angle-right"></span></button>
						</div>
					  <input type="hidden" name="circuit_breaker_id" value="1">
					  </form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

the result…

why is the array empty? The page has…

<?php
session_start();

include '../../db/pdo_conn.php';

echo '<pre>';print_r($_POST);echo '</pre>';

I suspect your DB connection is failing. What do the error logs say? Do you have error reporting turned on?

POST’ing the form to the same page is ok. The problem is elsewhere.

Array
(
    [Manufacturer] => Dell
    [Model] => 4210
    [Phase] => 2
    [Voltage] => 4
    [Poles] => 2
    [amp_rating] => 6
    [Notes] => None
    [circuit_breaker_id] => 1
)

For the end of the URL to have ?id=1 on it, that’s not there in the posted action=‘…’ attribute, there’s either some javascript involved in submitting the form data or you are redirecting somewhere, adding it, and are only seeing the end result of the redirect.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.