# Problem With Reservation Form Function

Page 1 of 1

## 0 Replies - 1741 Views - Last Post: 14 November 2012 - 04:24 PM

### #1 ChiCityCode

Reputation: 0
• Posts: 1
• Joined: 14-November 12

# Problem With Reservation Form Function

Posted 14 November 2012 - 04:24 PM

Hello everyone I'm new to this forum and new to coding so please excuse my lack of experience on this topic. I'm having trouble getting my function to properly obtain all the variables and output them into a message. I think the problem may be that my radio buttons and check boxes are not properly linked to my function. I'm really just not sure what I should be looking for at this point so any help would be greatly appreciated! Thanks!!!

```<!DOCTYPE html>
<html lang="en">
<title>Reservation Page</title>
<meta charset="utf-8" />

<script type="text/javascript">
function doStuff()
{

var last;
var first;
var city;
var hotel;
var travelers;
var days;
var wifi;
var recline;
var meal;

last = document.reservation.txtLastName.value;
first = document.reservation.txtFirstName.value;
travelers = document.reservation.selTravelers.value;
days = document.reservation.selDays.value;
wifi = document.reservation.optional.value;
recline = document.reservation.optional2.value;
meal = document.reservation.optional3.value;

city = parseInt(city);
hotel = parseInt(hotel);
travelers = parseInt(travelers);
days = parseInt(days);
wifi = parseInt(wifi);
recline = parseInt(recline);
meal = parseInt(meal);
todaysDate = Date();

totalCost = travelers*(city + (days*hotel) + wifi + recline + meal)

document.write("We recieved your reservation on " +  todaysDate + ". Your total cost is \$" + totalCost + ".");
}
</script>

<body>

<img src="BusLogo.jpg" alt="BusLogo" width="120%" height="120%">
<h5>Chicago's Most Reliable Bus Service</h5>

</div>

<div id="nav">
<ul type="square">
<li> <a href="busline_reservation.html">Make a Reservation</a> </li>
<li> <a href="busline_home.html">Home</a></li>
</ul>
</div>

<div id="reservation_form">

<form name="reservation">

<p><b>Last Name:</b>
<input type="text" name="txtLastName" style="background-color:#E0E0E0" />
</p>
<p><b>First Name:</b>
<input type="text" name="txtFirstName" style="background-color:#E0E0E0" />
</p>

<p><b>Arrival City:</b><br />
</P>

<p><b>Hotel Choice:</b><br />
</P>

<p><b>Number of Travelers: </b>
<select name="selTravelers">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select></p>

<p><b>Number of Days: </b>
<select name="selDays">
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select></p>

<p><b>Optional:</b>
<input type="checkbox" name="optional" value="10">Wifi
<input type="checkbox" name="optional2" value="20">Fully-Reclining Seat <br />
</p>

<p><b>Meal Choice:</b><br />
</P>

<p><b>Special Requests:</b><br />
<textarea rows="4" cols="35">
</textarea>

<input type="button" value="Book My Trip!" style="background-color:#FFCC73;" onclick="doStuff()" />
</form>
</div>

<div id="footer">
<h6>875 N Michigan Ave<br />Chicago<br />312.751.3681</h6>
</div>
</body>
</html>

```

#### Attached File(s)

Is This A Good Question/Topic? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }