New to this forum and to programming in PHP, so apologies if I miss some detail.
I have found some code which does almost everything I need, but I can't figure out how to get the 'selected item' from the results on an secondary page (reading in post) ..
this properly retrieves a list of names from a sql table and populates a select list, and two input boxes
<div id="ifNew" style="display:none" >
<form name = "form2" action="../Form/modified.php" method = "post" enctype = "multipart/form-data">
<div class = "form_data1">
<?php
$stmt = sqlsrv_query( $conn,$tsql );
if( $stmt === false) { die( print_r( sqlsrv_errors(), true) );}
echo "<select id=''nm'' name=''Name''>";
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))
{ echo "<option value='" . $row['Name']. "'>" . $row['Name'] . "</option>";
}
echo "</select>";
sqlsrv_free_stmt($stmt);?>
<input type = "text" name = "group" value = "" size = "30" required/><label> :Group</label> <br>
<input type = "text" name = "btype" value = "" size = "30" required/><label> :Type</label><br>
<input type = "submit" />
</form>
</div>
</div>
</div>
What I am struggling with is how to retrieve the selected item from the name list and populate a variable
modified.php
<?php
$group = $_POST['group'];
$btype = $_POST['btype'];
$name = $_POST['name'];
?>
while the first two are popuated (group and btype), the name is not, and i receive an error
Notice: Undefined index: name in C:\inetpub\wwwroot\testWeb\Form\modified.php on line 4
please help