Web Analytics Made Easy -
StatCounter reset the url variable.. - CodingForum


No announcement yet.

reset the url variable..

  • Filter
  • Time
  • Show
Clear All
new posts

  • reset the url variable..

    I want to use
    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...

    <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 { ?>
       					 print "<option value=\"{$row_rs_industry['industry_id']}\"" .
    					(isset($_GET['industry_id']) && $_GET['industry_id'] == $row_rs_industry['industry_id'] ? " selected>" : ">") . 
    				  <?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>" : ">") . 
    				 } while ($row_rs_productcategory = mysql_fetch_assoc($rs_productcategory)); ?>
    		 		<?php } ?></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>" : ">") . 
    					 } while ($row_rs_product = mysql_fetch_assoc($rs_product)); ?>
    				<?php } ?> 	
    				<tr><td>&nbsp;</td><td><input type="submit" value="Find" name="find"></td></tr>

  • #2
    the $_POST collection is not part of the url. it's part of the http header.
    the $_GET collection is sent through the url.
    so i don't understand your question/idea/problem ...

    if you want me to look at your code, then at least use the [php] tags instead of [code] tags
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


    • #3
      My main problem is how its being handled i just want for example the user has selected 2 of the dropdowns and the 3rd has been populated if they decide oh shoot i wanted a different industry and they go back to industry and select it it will reset the url to say just industry value = 1 and get rid of everythign after it. Right now it does not and the products stay populated even though they are the wrong ones...