Jump to content

first dropdown suddenly disappearing but second working good


srinivasa

Recommended Posts

here i have pasted file add-product.php in this first dropdown selecting but suddently disappearing(going to default) but second dropdown which is based on first dropdown is displaying correctly....

(this problem is part of product management store project as mentioned in my previous posts proceeding....)

please have a look and give me solution

 

//here is the code

<?php

session_start();

?>

 

<html>

<head><title>Add Product</title>

<!--FOR ADD-PRODUCT FORM-->

<script type="text/javascript" src="ADD-PRODUCT.js"></script>

<link rel = stylesheet href = "design.css" type = "text/css">

 

<script type = "text/javascript">

function showSelectedIndex(form){

var val = document.getElementById("firstbox").selectedIndex;

self.location = 'add-product.php?firstbox=' + val;

}

</script>

 

</head>

 

<body>

<!--CONNECT DATABASE-->

<?php include('connect-db.php'); ?>

 

<!--topmost-->

<table width = "100%" height = "10%">

<tr>

<td style="font-family:impact;color:gray;font-size:1.5pc;text-indent:80px">THE PRODUCT STORE</td>

<td style="font-family:verdana;font-size:.8pc;font-weight:bold;text-align:right;color:gray"><a href = logout.php>Logout</a></td>

</tr>

</table><br>

 

<!--middle-->

<table width = "100%" height = "100%">

<tr valign = "top">

<td div class = "left"></div></td>

<!--content-->

<td div class = "middle">

<table width = 100%><tr>

<td style="font-family:verdana;color:gray;font-size:.8pc;font-weight:bold;"width = 50%>ADD PRODUCT:</td>

<td style="font-family:verdana;color:gray;font-size:0.7pc;text-align:right" width = 32%><a href = add-product.php>Add Products</a>   |</td>

<td style="font-family:verdana;color:gray;font-size:0.7pc;text-align:right" width = 18%><a href = product-display.php>View Products</a></td>

</tr></table><br>

 

<form name = "product" onsubmit="return formValidator()">

<table width = 100% cellpadding = 5>

<!--product category-->

<tr>

<td style="font-family:verdana;color:gray;font-size:.8pc;font-weight:bold;"width = 50%>Product Category:</td>

<td width = 50%>

<?php

$ddone = @mysql_query("SELECT cat_id,cat_name FROM category");

echo "<select id = 'firstbox' name = 'maincat' onchange = 'showSelectedIndex()'>";

echo "<option> - - - - - - Select Category - - - - - - </option>";

while($row = mysql_fetch_array($ddone)){

$catid = $row['cat_id'];

$catname = $row['cat_name'];

echo "<option value = \"$catid\"> $catname </option>";

}

echo "</select>";

?>

</td>

</tr>

 

<!--product sub-category-->

<tr>

<td style="font-family:verdana;color:gray;font-size:.8pc;font-weight:bold;"width = 50%>Product Sub-category:</td>

<td>

<?php

@$cat = $_GET['firstbox'];

$ddtwo = @mysql_query("SELECT cat_id,subcat_name FROM subcategory WHERE cat_id = $cat");

echo "<select name = 'subcat'>";

echo "<option> - - - - - - - Sub-Category - - - - - - - </option>";

while($now = mysql_fetch_assoc($ddtwo)){

$subcatid = $now['subcat_id'];

$subcatname = $now['subcat_name'];

echo "<option value = \"$subcatid\">$subcatname</option>";

}

echo "</select>";

?>

</td>

</tr>

 

<!--product name-->

<tr>

<td style="font-family:verdana;color:gray;font-size:.8pc;font-weight:bold;"width = 50%>Product Name:</td>

<td><input type="text" name="pn" value = "" size = 30></td>

</tr>

 

<!--product price-->

<tr>

<td style="font-family:verdana;color:gray;font-size:.8pc;font-weight:bold;"width = 50%>Product Price:</td>

<td><input type="text" name="pp" value = "" size = 30></td>

</tr>

 

<!--product description-->

<tr>

<td valign =top style="font-family:verdana;color:gray;font-size:.8pc;font-weight:bold;"width = 50%>Product Description:</td>

<td><textarea cols="23" rows="5" name="pd"></textarea></td>

</tr>

</table>

 

<!--product image-->

<table cellpadding = 3>

<tr>

<td style="font-family:verdana;color:gray;font-size:.8pc;font-weight:bold;"width = 51%>Product Image:</td>

<td width = 35% align = left><input type="file" name="pi" value = ""></td><td></td>

</tr>

<tr><td></td><td align = right><br><input type = submit name = 'submit' value = 'submit'></td></tr>

</table>

 

</form>

 

</div>

</td>

 

<td div class = "right"></div></td>

</tr>

</body>

</html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...