I have one form which on submit sends data to external .php script. I want to disable possibility of inserting 2 students with same name into database. So if input was invalid, I want that inputed fields in form have last inputed values. I solved that, but i don't know how to retrieve last selected options? This is my code:

```
<form action="student.php" name="add-student" method="post" onSubmit="return Validate()">
Firstname:<input type="text" name="firstname" value="<?php  if(isset($_GET['firstname'])){echo $_GET['firstname'];}

Degree:<select name="degree" value="<?php if(isset($_GET['degree'])){echo '<option value=$_GET[["degree"]></option>';} ?>"> **//This is what i can't solve!!!**
<option value="1">First degree</option>
<option value="2">Second degree</option>
<option value="3">Third degree</option>
</select>
</form>

```

My external php script:

```
<?php
$firtsname=$_POST['firstname'];
$degree=$_POST['degree'];

$duplicate=mysqli_query($con,"SELECT * FROM student WHERE firstname='$firstname'");
if(mysqli_num_rows($duplicate)>0)
{
$row = mysqli_fetch_assoc($duplicate);

echo '<script type="text/javascript">';
echo 'alert("Name already exists in db.")';
echo '</script>'; 
echo "<script>window.location.assign('http://localhost/administrator.php?firstname=".$firstname."&degree=".$degree."'); </script>";
}
else{
$sql="INSERT INTO student (firstname,degree) VALUES('$firstname','$degree')";
?>

```