We help IT Professionals succeed at work.
Get Started

Submit  not wokring in IE and second drop down disappears on submit

PranjalShah
PranjalShah asked
on
277 Views
Last Modified: 2013-12-12
I am wokring on a PHP script that has forms and submit buttons on it. The script works fine with the dropdown boxes. I am getting the desired results out of it. The only problem is the submit button is not wokring in IE and when I press second submit button on the page the second drop down disappears. I need help with this. And also if you can show me the way on how I can keep the selected values to be there even on form submit it will be great.

Thanks
<?php
 
 
@mysql_select_db($database) or die( "Unable to select database");
 
$query="SELECT distinct chassis_vendor FROM chassis";
 
/* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */
 
$result = mysql_query ($query);
?>
<form name="vendor" method="post">
<?php 
echo "Please select the Vendor: ";
 
echo "<select name=name>Chassis Vendor</option>";
// printing the list box select command
 
while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option>$nt[chassis_vendor]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box 
?>
<input id="submit" type="submit" value="Submit" name="submit"/>
</form>
<?php 
if(isset($_POST['submit'])){
	$vendor = $_POST['name'];
	$query1="SELECT chassis_name FROM chassis where chassis_vendor='$vendor'";
	$result1 = mysql_query($query1);
	
?>
<form name="name" method="post">
<?php 
echo "Please select the Chassis for $vendor: ";
echo "<select name=vendor>Chassis Name</option>";
while($nt1=mysql_fetch_array($result1)){
echo  "<option>$nt1[chassis_name]</option>";
}
echo "</select>";
 
?>
<input name="submit1" type="submit" id="submit1" value="Submit"/>
 
<?php
}
if(isset($_POST['submit1'])){
	$name = $_POST['vendor'];
	
echo "Configuration for $vendor $name is as below:";
}?>
</form>

Open in new window

Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 16 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE