Jump to content

reset the url variable..


Codeman0013

Recommended Posts

I want to use [code]unset($_POST['productCat_id']);[/code] to clear out my url if the user selects a new industry_id . Here is my code maybe you can help me understand where it goes...

[code]<form name="distributers" />
  <table class="setTbl listTbl" width="90%" cellpadding="0" cellspacing="0" border="0">
<tr><td width="15%">Industry:</td>
<td width="85%">
<select name="industry_id" id="industry" onchange="document.distributers.submit();">

  <option value="">Select an Industry...</option>
  <?php do { ?>
<?php
  print "<option value=\"{$row_rs_industry['industry_id']}\"" .
(isset($_GET['industry_id']) && $_GET['industry_id'] == $row_rs_industry['industry_id'] ? " selected>" : ">") .
  "{$row_rs_industry['industry_name']}</option>\n";?>

 
  <?php } while ($row_rs_industry = mysql_fetch_assoc($rs_industry)); ?>
</select> </td></tr>
<tr><td>Product category:</td><td>

<?php if ($_GET['industry_id'] == null || $_GET['industry_id'] == "")  { ?>

<select name="productCat_id" id="productcat" onchange="document.distributers.submit();" disabled>;
<?php } else {
mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_productcategory = "SELECT productCat_id, productCat_name, industry_id FROM tbl_productcat WHERE industry_id = '$_GET[industry_id]' ORDER BY productCat_name";
$rs_productcategory = mysql_query($query_rs_productcategory, $conn_dj) or die(mysql_error());
$row_rs_productcategory = mysql_fetch_assoc($rs_productcategory);
$totalRows_rs_productcategory = mysql_num_rows($rs_productcategory);
?>
<select name="productCat_id" id="productcat" onchange="document.distributers.submit();" >
  <option value="">Select a product category...</option>
<?php do {
  print "<option value=\"{$row_rs_productcategory['productCat_id']}\"" .
(isset($_GET['productCat_id']) && $_GET['productCat_id'] == $row_rs_productcategory['productCat_id'] ? " selected>" : ">") .
  "{$row_rs_productcategory['productCat_name']}</option>\n";
} while ($row_rs_productcategory = mysql_fetch_assoc($rs_productcategory)); ?>
</select>
<?php } ?></td>

<tr><td>Product:</td><td>

<?php if ($_GET['productCat_id'] == null || $_GET['productCat_id'] == "" || ($_GET['industry_id'] == null || $_GET['industry_id'] == "")) { ?>
<select name="products_id" id="products" onchange="document.distributers.submit();" disabled>;
<?php } else {
mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_product = "SELECT products_id, products_name, productCat_id FROM tbl_products WHERE productCat_id = '$_GET[productCat_id]' ORDER BY products_name";
$rs_product = mysql_query($query_rs_product, $conn_dj) or die(mysql_error());
$row_rs_product = mysql_fetch_assoc($rs_product);
$totalRows_rs_product = mysql_num_rows($rs_product);
?>
<select name="products_id" id="products" onchange="document.distributers.submit();" >
  <option value="">Select a product...</option>
<?php do {
  print "<option value=\"{$row_rs_product['products_id']}\"" .
(isset($_GET['products_id']) && $_GET['products_id'] == $row_rs_product['products_id'] ? " selected>" : ">") .
  "{$row_rs_product['products_name']}</option>\n";
} while ($row_rs_product = mysql_fetch_assoc($rs_product)); ?>
</select>
<?php } ?>
</td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Find" name="find"></td></tr>
  </table>
</form>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.