[thelist] input type="image" vs. input type="button"

Christian Heilmann codepo8 at gmail.com
Thu Aug 24 15:44:50 CDT 2006


> > It seems to me you are trying to solve a problem that won't exist ...
> >once your link looks like this...
> >
> > http://example.com/product.php?productid=1
> >
> > ... Your html ends up like this:

And you are probably VERY vulnerable to XSS. Wouldn't it be nice to
just take what someone asks for and give a solution for that?

Change your FORM to this:

  <form name="quickform" action="send.php" method="post">
          <label for="quickpicks">Select a topic:</label>
          <select name="quickpicks">
                  <option value="selected">Tell me more about...</option>
                  <option value="product1.php">Product One</option>
                  <option value="product2.php">Product Two</option>
                  <option value="product3.php">Product Three</option>
                  <option value="product4.php">Product Four</option>
                  <option value="product5.php">Product Five</option>
          </select>
          <input type="image" src="go.gif" alt="go" />
  </form>

and send.php:

<?php header('Location:'.$_POST['quickpicks']);?>

You can then add a JavaScript that makes sure the first choice isn't
picked, or rather get rid of it.

-- 
Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/



More information about the thelist mailing list