I have the following code
How do i first edit this to take errors and also to be able to attach files.
<?php
//Gets these from page before
$mail_ref = $_GET['mail_ref'];
$mail_title = $_GET['mail_title'];
$mail_location = $_GET['mail_location'];
?>
<title>RFC Job Application</title>
<link rel='stylesheet' href='../../rfcStyle.css' type='text/css'>
</head>
<body bgcolor='#ffffff' leftMargin='0' topMargin='6' marginheight='0' marginwidth='0'>
<table cellspacing='0' border='2' cellpadding='0' align='center' width='620' bordercolor='#000080'>
<tr>
<td class=bar><table width='97%' align='center' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td class='banner' nowrap>RFC Recruitment Group</td>
<td class='banner' nowrap align='right'>Management & Professional Recruitment</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src='../../images/titleRfc.gif' width='185' height='70'></td>
</tr>
<tr>
<td class=title><img src='../../images/imgJobApplication.gif' width='295' height='33'></td>
</tr>
<tr>
<td align='center'>
<!-- START OF FORM -->
<form ACTION="sendmail.php" METHOD=POST align='center'>
<table cellspacing='2' cellpadding='2' border='0' width='100%' bgcolor=#ffffff>
<tr class=content2>
<td class='heading'>Ref No.</td>
<td class='heading'>Job Title</td>
<td class='heading'>Location</td>
</tr>
<tr class=content2>
<td><input name='mail_ref' value="<? echo $mail_ref ?>" type='text' size='20' style='width: 180px; height: 22px;'></td>
<td><input name="mail_title" value="<? echo $mail_title ?>" type='text' size='20' style='width: 180px; height: 22px;'></td>
<td><input name='mail_location' value="<? echo $mail_location ?>" type='text' size='20' style='width: 180px; height: 22px;'></td>
</tr>
<tr>
<td colspan=3 class='title' height=20 valign='center' align='center'>Your Details <font class=content3>(* Required Information)</font></td>
</tr>
<tr>
<td class='heading'><font class='content3'>*</font> Your Name</td>
<td class='heading'>Email Address </td>
<td class='heading'>Phone No.</td>
</tr>
<tr>
<td><input name='mail_Name' tabindex='1' type='text' size='20' style='width: 180px; height: 22px;'></td>
<td><input name='mail_Email' tabindex='2' type='text' size='20' style='width: 180px; height: 22px;'></td>
<td><input name='mail_Tel' tabindex='3' type='text' size='20' style='width: 180px; height: 22px;'></td>
</tr>
<tr>
<td class='heading'><font class='content3'>*</font> Contact Address</td>
<td class='heading' colspan='2'>Additional Comments</td>
</tr>
<tr>
<td>
<textarea name='mail_Contact' tabindex='4' style='width: 180px;' cols='20' rows='4' wrap='physical'></textarea></td>
<td colspan='2'><textarea name='mail_Comments' tabindex='5' rows='4' style='width: 360px;' cols='40'></textarea></td>
</tr>
<tr>
<td colspan='3' align='center' valign='center' height='50'>
</td>
</tr>
<tr>
<td colspan='3' align='center' valign='center' height='50'><input name="submit" type='submit' tabindex='6' value=' Send Application '></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td class=bar height='15' align='center'>
<a class=headlink href='javascript:window.close();'>Close Window</a></td>
</tr>
</table>
</body>
</html>
<?
//////////////////////////PAGE 2
//first_mail.php
$mail_to = "bla@bla.com";
//$mail_subject = "Hi there";
$mail_ref = $_POST['mail_ref']; //Subject
$mail_title = $_POST['mail_title']; //Job Title
$mail_location = $_POST['mail_location']; //Location
$mail_Name = $_POST['mail_Name']; //Name
$mail_Email = $_POST['mail_Email']; //Email address
$mail_Tel = $_POST['mail_Tel']; //Tel number
$mail_Contact = $_POST['mail_Contact']; //Contact details
$mail_Comments = $_POST['mail_Comments']; //Comments
///MAin Body :::
$mail_body = "Location: $mail_location \n Job Title: $mail_title \nName: $mail_Name \nEmail: $mail_Email \nTel: $mail_Tel \nContact: $mail_Contact \nComments: $mail_Comments \n";
?>