Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
so I am trying my hand at php again :)
26-10-2006, 05:00 PM
Post: #1
so I am trying my hand at php again :)
I have been working on a php/mysql page to display info about branches in a selected region for my work.

All is working, however I am trying to get it so the users can select a region from a combo box, click submit and then the page reloads with the correct region info.

Doesnt work though as the url it reloads is this: allregions.php?regionid='$rid' , '$rid' should be the actual value.

here is the code:

Code:
        <form action="allregions.php?regionid=$rid" $rid method="post">
    <select name="rid_combo" size="1" id="RID">  
<?php
    $query = "SELECT RID, region FROM tbl_regions";
    $result = mysql_query($query);

    while($row = mysql_fetch_assoc($result))
        {
            $RID = $row["RID"];
            $region = $row["region"];
            ?>
            
            <option value="<?php echo $RID; ?>"><?php echo htmlentities($region, ENT_QUOTES); ?></option>
            
            <?php
        } //End while
?>

    </select>

    <input type="submit" value="Update" />
    </form>

ok it may not be the prettiest code, but I dont care I just want this bit to work.

- Techmonkey
================
Enterprise Business IT Support | SME IT Support | Home Support Available
Send this user an email Visit this user's website Find all posts by this user
Quote this message in a reply
26-10-2006, 05:54 PM
Post: #2
 
w00t I R the win.

Damn post and gets grrr

- Techmonkey
================
Enterprise Business IT Support | SME IT Support | Home Support Available
Send this user an email Visit this user's website Find all posts by this user
Quote this message in a reply
26-10-2006, 06:45 PM
Post: #3
 
Ah, looking on the query string rather than the form, were we?

Give me liberty, or give me death - Patrick Henry 1775.
Think for yourselves and let others enjoy the privilege to do so too - Evelyn Beatrice Hall 1906
I spread my wings, only to find that they are paper in the rain - Neko 2006
Send this user an email Visit this user's website Find all posts by this user
Quote this message in a reply
05-03-2007, 06:06 PM
Post: #4
 
it's calling the var before it's declared. put the query before the form starts.

[Image: iSig_v05.jpg]
Send this user an email Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: