I am trying to use a javascript in my form. I am new to php and javascript but there should be a way for this script to work.
My code is below...
<?
session_start();
session_unset();
session_register("selecttown");
session_register("bedroomsel");
session_register("bathselect");
session_register("lowprice");
session_register("highprice");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
?>
<script>
var isNS4 = (navigator.appName=="Netscape")?1:0;
</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
}
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}
// End -->
</script>
<?php
include("../includes/resheader.php");
?>
<p>
<center>
Use our search form below to enter information on the type of property you are looking for, and click on 'submit'.<br>
We
will search our database and display the results of your search in just a few seconds.
<form action="maincode.php" method="POST">
<table border="0" width="63%" bgcolor="#FEF5ED">
<tr>
<td width="100%">
<table border="0" width="100%">
<tr>
<td width="20%" bgcolor="#003366" align="center"><strong><font color="#FFFFFF" face="Tahoma" size="2">Town</font></strong></td>
<td width="20%" bgcolor="#003366" align="center"><strong>
<font color="#FFFFFF" face="Tahoma" size="2">Price Range</font></strong></td>
<td width="20%" bgcolor="#003366" align="center"><strong>
<font color="#FFFFFF" face="Tahoma" size="2">Bed Rooms</font></strong></td>
<td width="20%" bgcolor="#003366" align="center"><strong>
<font color="#FFFFFF" face="Tahoma" size="2">Baths Rooms</font></strong></td>
</tr>
<tr>
<td width="20%">
<table><tr><td>
<select multiple size="10" name="list1" style="width:150">
<option value="Lyme NH">Lyme, NH</option>
<option value="Hanover NH">Hanover, NH</option>
<option value="Lebanon NH">Lebanon, NH</option>
<option value="Plainfield NH">Plainfield, NH</option>
<option value="Enfield NH">Enfield, NH</option>
<option value="Canaan NH">Canaan, NH</option>
<option value="Grafton NH">Grafton, NH</option>
<option value="Grantham NH">Grantham, NH</option>
<option value="Eastman NH">Eastman, NH</option>
</select>
</td>
<td align="center" valign="middle">
<input type="button" onClick="move(this.form.list2,this.form.list1)" value="<<">
<input type="button" onClick="move(this.form.list1,this.form.list2)" value=">>"></td>
<td>
<select multiple size="10" name="list2" style="width:150">
</select>
</td></tr></table>
</td>
<td width="20%">
Enter your lowest price
$<input type="text" name="lowprice" size="20" value="0">
Enter your highest price
$<input type="text" name="highprice" size="20" value="300000">
</select>
</td>
<td width="20%">
<input type="radio" value="%" name="bedroomsel" checked><font face="Courier">Any<br>
<input type="radio" value="1" name="bedroomsel"">1<br>
<input type="radio" value="2" name="bedroomsel"">2<br>
<input type="radio" value="3" name="bedroomsel"">3</font></td>
<td width="20%">
<input type="radio" value="%" name="bathselect" checked><font face="Courier">Any<br>
<input type="radio" value="1" name="bathselect">1<br>
<input type="radio" value="2" name="bathselect">2</font></td>
</tr>
</table>
<p align="center"><input type="submit"><input type="reset"></p>
</form>
</td>
</tr>
</table>
</form>
</center>
<p>
<?php
include("footer.php");
?>
Basically, I am having issues with my town selection.... name="list1"
I really need the town select to be the variable selecttown[] not list2
I cant seem to get php and javascript to 'play nice' how can I get the results from the town selection java script to be selecttown[]