Hello everyone i have two forms that are similiar the only difference is the rma number. One RMA number will get typed in by the user which will add it to the database and the second one, the user will select an rma number from the database(dropdown menu). What i want the second one to do is use ajax to populate the form with data from mysql from that rma number.
This is the form i will select the rma number:
<?php
//connect to the database
include('Model/DBAdapter.php');
//create sql statement
$sql = "SELECT RMA_Number FROM INC_Test";
//Retrieve data
$result = $connection->query($sql);
//process results
if ($result){
//loop through data
while ($number = $result->fetch()){
$numbers[] = $number;
}
include 'View/IncomingUpdate.html.php';
} else {
$output = "No RMA Number found in database.";
include 'View/IncomingOutput.html.php';
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="Styles/inc.css"/>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Incoming Update</title>
</head>
<body>
<form id="incUpdateForm" action="" method="post">
<fieldset>
<legend>RMA Incoming Test Update</legend>
<ul>
<li>
<label>RMA Number:</label>
<select id="rmaNumber" name="rmaNumber" onchange="???">
<option>Choose an RMA Number:</option>
<?php foreach($numbers as $number):?>
<option value="<?php echo $number['RMA_Number'];?>"><?php echo $number['RMA_Number'];?></option>
<?php endforeach; ?>
</select>
</li>
<li>
<label>ISN:</label>
<input type="text" id="isn" name="isn" maxlength="12" class="validate[required],validate[custom[hex]]"/>
</li>
<li>
<label>IDT Employee:</label>
<select id="employee" name="employee" class="validate[required]">
<option value="">Employee Name...</option>
<option value="1">Brandon McBride</option>
<option value="2">Keith Carlson</option>
<option value="3">Glenn Davis</option>
<option value="4">Andrea Shupe</option>
<option value="5">Adam Shupe</option>
<option value="6">Angelo Polisinelli</option>
<option value="7">Bob Poor</option>
<option value="8">Steve Uban</option>
<option value="9">Rod Redlin</option>
<option value="10">Erika Kaiser</option>
<option value="11">Liz</option>
</select>
</li>
<li>
<label>Check for Physical Damage:</label>
<textarea id="damage" name="damage" rows=5 cols=30 maxlength="400" class="validate[required]"></textarea>
</li>
<li>
<label>Log:</label>
<p id="red">Please take a Log of the unit with Scope.</p>
</li>
<li>
<label>Board:</label>
<select id="board" name="board" class="validate[required]">
<option value="">Choose a Board Type...</option>
<option value="G1">G1</option>
<option value="G1 Plus">G1 Plus</option>
</select>
</li>
<li>
<label>Battery Voltage Test:</label>
<input type="text" id="voltage" name="voltage" maxlength="12" />
<select id="voltage1" name="voltage1" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>Battery Serial Number:</label>
<input type="text" id="serial" name="serial" maxlength="12" />
<select id="serial1" name="serial1" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>MCU Firmware Version:</label>
<input type="text" id="mcufw" name="mcufw" maxlength="12" />
<select id="mcu1" name="mcu1" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>MCU Hardware Version:</label>
<input type="text" id="mcuhw" name="mcuhw" maxlength="12" />
<select id="mcu2" name="mcu2" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>DMR Firmware Version:</label>
<input type="text" id="dmrfw" name="dmrfw" maxlength="12" />
<select id="dmr1" name="dmr1" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>DMR Hardware Version:</label>
<input type="text" id="dmrhw" name="dmrhw" maxlength="12" />
<select id="dmr2" name="dmr2" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>DMR Script Version:</label>
<input type="text" id="script" name="script" maxlength="12" />
<select id="script1" name="script1" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>Leak Test:</label>
<select id="leak" name="leak" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>Verification Test:</label>
<select id="verify" name="verify" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
<li>
<label>Final Test:</label>
<select id="final" name="final" >
<option value="">Choose...</option>
<option value="Pass">Pass</option>
<option value="Fail">Fail</option>
</select>
</li>
</ul>
</fieldset> <p>
<input type="submit" id="sub" value="Update"/>
<input type="hidden" name="addMe" value="True" />
</p>
</form>
</body>
</html>