troubleshooting Question

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

Avatar of PranjalShah
PranjalShahFlag for United States of America asked on
PHPHTMLMySQL Server
16 Comments1 Solution279 ViewsLast Modified:
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

ASKER CERTIFIED SOLUTION
christophermccann

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros