Jump to content

KateS

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

KateS's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This is the code that I tried last but I have tried various different ways. SearchString was the name that I had for the variable for the menu result. <?php             $SearchString_DriffieldRS = "-1"; if (isset($_GET['SearchString'])) {   $SearchString_DriffieldRS = (get_magic_quotes_gpc()) ? $_GET['SearchString'] : addslashes($_GET['SearchString']); } mysql_select_db($database_myTownQuery, $myTownQuery); $query_DriffieldRS = "SELECT * FROM Businesses WHERE Businesses.town='Driffield' and Businesses.business_type='".chop($_GET['SearchString'])."'' ORDER BY Businesses.business_name"; $DriffieldRS = mysql_query($query_DriffieldRS, $myTownQuery) or die(mysql_error()); $row_DriffieldRS = mysql_fetch_assoc($DriffieldRS); $totalRows_DriffieldRS = mysql_num_rows($DriffieldRS); ?> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="get" name="Businesses">                 <select name="SearchString" title="<?php echo chop($_GET['SearchString']); ?>" onChange="document.forms['Businesses'].submit()">              <option selected>Please select</option>             <option value="Accountants">Accountants</option>             <option value="Acupuncture">Acupuncture</option>             <option value="Advertising Services">Advertising Services</option>             <option value="Agricultural Services">Agricultural Services</option>                       </select>        </form>                                    <?php if ($totalRows_DriffieldRS > 0) { // Show if recordset not empty ?>                   <?php echo chop($_GET['SearchString']); ?><br>                   <?php do { ?>                   <?php echo $row_DriffieldRS['business_type']; ?><br>                   <?php echo $row_DriffieldRS['business_name']; ?>&nbsp;<?php echo $row_DriffieldRS['first_name']; ?> <?php echo $row_DriffieldRS['last_name']; ?> <?php echo $row_DriffieldRS['address1']; ?> <?php echo $row_DriffieldRS['address2']; ?> <?php echo $row_DriffieldRS['town']; ?> <?php echo $row_DriffieldRS['county']; ?> <?php echo $row_DriffieldRS['postcode']; ?><br>                   <?php echo $row_DriffieldRS['tel_no_01']; ?>&nbsp;<?php echo $row_DriffieldRS['tel_no_02']; ?><br>                   <br>                   <?php } while ($row_DriffieldRS = mysql_fetch_assoc($DriffieldRS)); ?>                   <?php } // Show if recordset not empty ?>               <?php mysql_free_result($DriffieldRS); ?>
  2. Have tried using onChange="document.forms['Businesses'].submit()" but that didn't work. I have tried using a variable to store the information from the selected option but it doesn't recognise it. Also as I have been working on this now for quite some time there is the chance that I have screwed something up as I have changed something else as I am getting a mysql syntax error message for a line which has only a <tr> tag on it.
  3. I would prefer it to use the displayed option and update itself rather than have the user click a submit button but at this stage anything would be useful as i have been unable to get either to work.
  4. Can anyone help to save me from an untimely and possibly violent demise and point my owner to where she can find out how to use a select menu in Dreamweaver, which when the user has selected an option will display results from a mysql database in a separate table on the same page? She has tried numerous different ways of doing this and although parts of the script have worked it has not worked fully. She has followed the help menu in dreamweaver, various books on php and mysql and before she ends up throwing me out of the window can someone help me? Please, I'll love you forever, Kate's Mac!
×
×
  • 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.