This is driving me batty....

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default This is driving me batty....

    ....I'm posting this here, because it's probably more appropriate than
    over in the Dreamweaver forum, although I suspect most everyone here is
    also over there. This forum just seems quieter, somehow.

    I am still, two days into it, trying to figure out how to call data
    using a drop-down menu.

    Here's the code, as generated by Dreamweaver:

    <form action="searchresult.php?category_id=<?php echo
    $row_RS2['category_id']; ?>" method="post" name="form1">
    <select name="select">
    <?php
    do {
    ?>
    <option value="<?php echo $row_RS2['category_id']?>"<?php if
    (!(strcmp($row_RS2['category_id'], $row_RS2['category_id']))) {echo
    "SELECTED";} ?>><?php echo $row_RS2['category_id']?></option>
    <?php
    } while ($row_RS2 = mysql_fetch_assoc($RS2));
    $rows = mysql_num_rows($RS2);
    if($rows > 0) {
    mysql_data_seek($RS2, 0);
    $row_RS2 = mysql_fetch_assoc($RS2);
    }
    ?>
    </select>
    <input name="search" type="submit" id="search"
    onClick="MM_jumpMenuGo('menu1','parent',0)" value="Go">
    </form>
    <p>&nbsp; </p>
    </body>
    </html>
    <?php
    mysql_free_result($RS2);
    ?>

    Okay. When I do this, the URL Parameter that gets sent is always 1.

    searchresult.php?category_id=1



    Gary suggested that I do this:

    <form name="form1" method="post" action="searchresult.php">
    <input type="hidden" name="category_id"
    value="<?php echo $row_RS2['category_id'];?>">

    But when I do that, there are no URL Parameters at all.

    So I tried changing the method from post to get.

    Success, it now changes the Category ID to what I select.

    Failure, it calls this:

    searchresult.php?select=4&search=Go

    Which, of course, php doesn't interpret as a URL parameter, so it fails,
    and calls the default of, you guessed it...one.

    I can get it to work if I do this:

    <td><a href="searchresult.php?category_id=<?php echo
    $row_rs1['category_id']; ?>"><?php echo $row_rs1['category_name'];
    ?></a></td>
    <td><?php echo $row_rs1['biz_name']; ?></td>
    </tr>
    <?php } while ($row_rs1 = mysql_fetch_assoc($rs1)); ?>

    Which creates a list of all my categories. But the fact that I can't get
    the form to work is really, really annoying me.

    Does anyone have a solution? Maybe a sample that I can look at that works?
    Tron Guest

  2. Similar Questions and Discussions

    1. 3D Driving Game
      Hi all, I just have a quick question today, hopefully it is quite an easy one to solve... Ok, i am making a 3D driving game which consists of...
    2. two things driving me mad .
      Ok , I´m a heavy PS abuser , so this is probably not an issue for most of the people :-) 1 . beauty full new tool: highlight /shadow adjustment ,...
    3. Please help - this has been driving me nuts!
      Hi I am attempting to port a CDROM project to the web. The progress bar loads fine - and just before the movie kicks off - I get a dialog box...
    4. Template driving me mad
      Have I got the wrong idea about templates ? I design a page .. save it as a template with an editable area. Open the template ...input some...
    5. CSS is driving me MAD!!!
      I am a newbie...obviously! I have noticed site, of course, that have there background that goes from browser wall to wall with no white space...
  3. #2

    Default Re: This is driving me batty....

    Ha ha.

    I found the problem.

    It wasn't on my search page at all.

    It was on my search results page.

    I did not know that when using "Get", I had to filter by Category_id,
    but then set the URL parameter to whatever my form was named on the
    previous page.

    Three days into the whole process, and I finally found something
    somewhere that said that....

    I'm going to go post a similar note to Gary out on the main page, cuz
    I'm not sure he reads this one.
    Tron Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139