View Full Version : A select all option in Dreamweaver list/menu

10-10-2008, 10:28 AM

I would like to insert a select all option in multiple lists/menus on a search page. I am using php and mysql. Is there a value which I can use in the dynamic list/menu option box which will select everything from a specific field. The code for the search page is

<form action="resultspage.php" method="get" name="formtest" id="formtest">
<select name="select" size="8" multiple="multiple">
<option value="Lyng" <?php if (!(strcmp("Lyng", $_GET['formtest']))) {echo "selected=\"selected\"";} ?>>Lyng</option>
<option value="Murphy" <?php if (!(strcmp("Murphy", $_GET['formtest']))) {echo "selected=\"selected\"";} ?>>Murphy</option>
<option value="Smith" <?php if (!(strcmp("Smith", $_GET['formtest']))) {echo "selected=\"selected\"";} ?>>Smith</option>
<select name="select2">
<option value="Cork" <?php if (!(strcmp("Cork", $row_Recordset1['Address']))) {echo "selected=\"selected\"";} ?>>Cork</option>
<option value="Ireland" <?php if (!(strcmp("Ireland", $row_Recordset1['Address']))) {echo "selected=\"selected\"";} ?>>Ireland</option>
<option value="*" <?php if (!(strcmp("*", $row_Recordset1['Address']))) {echo "selected=\"selected\"";} ?>>All towns</option>
<input name="Submit" type="submit" value="Submit" />

The code i have for the results page is

<table border="1" cellpadding="1" cellspacing="1">
<td width="142"><div align="center">ContactID</div></td>
<td width="144"><div align="center">FirstName</div></td>
<td width="162"><div align="center">LastName</div></td>
<td width="141"><div align="center">Address</div></td>
<?php do { ?>
<td><div align="center"><?php echo $row_test['ContactID']; ?></div></td>
<td><div align="center"><?php echo $row_test['FirstName']; ?></div></td>
<td><div align="center"><?php echo $row_test['LastName']; ?></div></td>
<td><div align="center"><?php echo $row_test['Address']; ?></div></td>
<?php } while ($row_test = mysql_fetch_assoc($test)); ?>

It all works OK except for the select ALL TOWNS option in the search page


10-10-2008, 12:12 PM
if i understand you correctly you want a single option to select everything in a multi select list like using highlighting every option and submitting that.

is this correct?

10-14-2008, 02:37 PM

Yeah, thats what I would like. As users of the website may not realise that a complete search can be done on a field by higlhighting all the options.

10-14-2008, 05:06 PM
just set the top option to ALL then detect ALL through PHP and then handle the search within the SQL query

10-15-2008, 11:25 AM

I have placed 'All' in the value/name boxes of the list menu dialog box. This does not seem to work. Is there a special symbol for all that I should use for the value. Also I am not too sure what you mean by handling the search within the sql query.

10-15-2008, 12:28 PM
how much php have you written? (by hand)

do you understand SQL and PHP

10-15-2008, 01:01 PM
I have no experience with PHP and have only just delved into sql and it is beginning to make some sense. I am just beginning to become interested in both PHP and sql. But I was hoping that I may be able to sort out the 'select all' problem within dreamweaver itself using just the essential sql coding.

10-15-2008, 03:49 PM
contact me through MSN Messenger