Jump to content

[SOLVED] this.form.submit() won't go to the right page


miseleigh

Recommended Posts

I call the following from products.php:

<form action="http://www.mysite.com/products/bybrand.php" method="post">
          <select name="brand" onChange="this.form.submit()">
                        <option value="null"> Select Manufacturer </option>
                        <option value=1>Manufacturer 1</option>
                        <option value=2>Manufacturer 2</option>
                        <option value=3>Manufacturer 3</option>
          </select></form>

but when an option is selected, the page tries to go to products.html (which doesn't exist) instead of products/bybrand.php.  I have a few forms like this on products.php that are supposed to go to different pages, but they all do the same thing.  Any help would be greatly appreciated.

Well, nevermind... the original author had it redirecting back to the original products page if the varibale wasn't set and forgot to actually request it.  All fixed!

 

On products/bybrand.php:

<?php
  Header("Cache-Control: must-revalidate");

  $brand=$_REQUEST['brand'];  // I added this

  if(!isset($brand) || $brand == "null")
     header("Location: ../products.php");   //was originally products.html

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.