Sunday, 25 August 2013

Form choice direct to webpage

Form choice direct to webpage

Hi I am trying to get a form to route to a specified webpage based on
chosen options. I have seen some answers on a previous thread by
http://stackoverflow.com/users/726326/dentaku but can't get it to work
i've probably missed something simple. many thanks in advance
<!---
<form>
<p> Type of Purchase: </p>
<select id="type">
<option value="0" id="Select">Select</option>
<option value="1" id="vaccation_rental">Vaccation Rental</option>
<option value="2" id="purchase">Purchase</option>
<option value="3" id="rental">Long Term Rental</option>
</select>
<p>Type of Property</p>
<select id="property">
<option value="0" id="Select">Select</option>
<option value="1" id="Villa">Villa</option>
<option value="2" id="Cabana">cabana</option>
</select>
<br /><br />
<input onclick="goToPage();" type="button" value="Submit" />
</form>
<script type="text/javascript">
function goToPage()
{
<script>
var targetURL;
if (type==0) {
switch (property) {
case 1: targetURL = "http://www.mysite.com/index.html";
case 2: targetURL = "http://www.mysite.com/index.html";
case 3: targetURL = "http://www.mysite.com/index.html";
}
} else if (type==1) {
switch (property) {
case 1: targetURL = "http://www.mysite.com/Rental.html";
case 2: targetURL = "http://www.mysite.com/VRental_villa.html";
case 3: targetURL = "http://www.mysite.com/VRental_cabana.html";
}
} else if (type==2) {
switch (property) {
case 1: targetURL = "http://www.mysite.com/Buying.html";
case 2: targetURL = "http://www.mysite.com/Buying_villa.html";
case 2: targetURL = "http://www.mysite.com/Buying_cabana.html";
}
} else {
switch (property) {
case 1: targetURL = "http://www.mysite.com/Rental.html";
case 2: targetURL = "http://www.mysite.com/Rental_villa.html";
case 3: targetURL = "http://www.mysite.com/Rental_cabana.html";
}
}
targetURL ? window.location.href = targetURL : alert("Type of
Property.");</script>
<!-- end .content --></div>
<!-- end .container --></div>
</body>
</html>

No comments:

Post a Comment