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.

Link to comment
Share on other sites

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

 

 

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.