I am new to PHP and trying to get a simple form working and be able to be emailed to an administrator. I've gotten PHP forms to work before, but for some reason am having a lot of difficulty with this. Basically, when I hit my submit button, I get this garbage:
. I am using a WAMP server to accomplish this, not sure if iit has anything to do with the error but I don't believe it does.
This is my script on the main index page, just before closing html
function validate(){
var name=document.getElementById('employee');
var name=document.getElementById('start-date');
var name=document.getElementById('end-date');
var name=document.getElementById('location');
var name=document.getElementById('company');
var name=document.getElementById('perdiem');
var name=document.getElementById('flight');
var name=document.getElementById('hotel');
var name=document.getElementById('rental');
var name=document.getElementById('depart');
var name=document.getElementById('city-venue');
var name=document.getElementById('submit');
if(employee.value == ''){
alert('Please enter employee name');
return false;
}
if(start-date.value == ''){
alert('Please enter start date');
return false;
}
if(end-date.value == ''){
alert('Please enter end date');
return false;
}
if(location.value == ''){
alert('Please enter location');
return false;
}
if(company.value == ''){
alert('Please enter employee company');
return false;
}
if(perdiem.value == ''){
alert('Please enter perdiem value');
return false;
}
if(depart.value == ''){
alert('Please enter departure details');
return false;
}
if(city-venue.value == ''){
alert('Please enter City-Venue');
return false;
}
}
Here is the form:
<div id="form">
<form method="get" name="contactform" action="handler.php" onSubmit="return validate()">
<h1>Employee to Request</h1>
<select id="employee">
<option value="emp1">sample1</option>
<option value="emp2">sample2</option>
</select><br>
<h1>Start Date:</h1> <input type="date" name="start-date"><br>
<h1>End Date:</h1> <input type="date" name="end-date"><br>
<h1>Location</h1>
<select id="location">
<option value="chicago">Chicago</option>
<option value="florida">Florida</option>
<option value="las-vegas">Las Vegas</option>
<option value="new-england">New England</option>
<option value="new-orleans">New Orleans</option>
<option value="new-york">New York</option>
<option value="northern-california">Northern California</option>
<option value="seattle">Seattle</option>
<option value="southern-california">Southern California</option>
<option value="washington-dc">Washington DC / Baltimore</option>
</select>
<h1>Company Name</h1>
<select id="company">
<option value="cmp1">cmp1</option>
<option value="cmp2">cmp2</option>
<option value="cmp3">cmp3</option>
</select>
<h1>Perdiem</h1>
<select id="perdiem">
<option value="35">$35</option>
<option value="45">$45</option>
<option value="50">$50</option>
</select>
<h1>Hotel</h1>
<select id="hotel">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<h1>Flight</h1>
<select id="flight">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<h1>Rental Car</h1>
<select id="rental">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<h1>Departing</h1>
<input type="text" name="depart" onClick="this.value='';" onFocus="this.select()" onBlur="this.value=!this.value?'Name: ':this.value;" value="Departing: " placeholder="Depart"><br>
<h1>City / Venue</h1>
<select id="city-venue">
<option value="city1">Las Vegas / Venue1</option>
<option value="city2">Orlando / Venue2</option>
<option value="city3">sample</option>
<option value="city4">sample2</option>
<option value="city5">sample3</option>
</select>
<br>
<h1>Other Information:</h1>
<textarea class="message" placeholder="Other Information:"type="text" name="message" onClick="this.value='';" onFocus="this.select()" onBlur="this.value=!this.value?'Message: ':this.value;" value="Message: "></textarea><br>
<input type="submit" value="Submit" id="submit">
</form>
</div> <!--close form-->
and here is handler.php file
<?php
$employee = $_GET['employee'];
$employee = $_GET['start-date'];
$employee = $_GET['end-date'];
$employee = $_GET['location'];
$employee = $_GET['company'];
$employee = $_GET['perdiem'];
$employee = $_GET['flight'];
$employee = $_GET['hotel'];
$employee = $_GET['rental'];
$employee = $_GET['depart'];
$employee = $_GET['city-venue'];
echo "Welcome".$employee;
echo "</br>"
?>
Thanks in advance, I really appreciate it