Page 1 of 1

Passing variables between pages

Posted: Sun Apr 13, 2008 1:10 am
by ECJughead

Code: Select all

<?php
    $type_set = @mysql_query('SELECT id, type FROM types');
        if (!$type_set) {
    exit('<p>Error performing query: ' . mysql_error() . '</p>');
        }
    while ($row = mysql_fetch_array($type_set)) {
    echo "<option value=\"{$row['id']}\">{$row['type']}</option>";
    }
?>
Using the above code, I need to be able to pass the chosen option ('type') through a url (something.php?type=xxx) where xxx='type'

My page was working before when I only used HTML and listed each option separately with <a href> tags and writing each 'type' out at the end of the url. This variable is used in a query in the next url page. I thought creating a drop-down list with a submit button would take up less room and look nicer. Can it be done?

Re: Passing variables between pages

Posted: Sun Apr 13, 2008 4:28 am
by deejay

Re: Passing variables between pages

Posted: Mon Apr 14, 2008 6:08 am
by ECJughead
So instead of "method="post", use "get"?

I've tried a few things and I still can not get it to pass a variable along to a new page