I have created a very simple PHP form pointing to my MySQL database, and everything runs fine including the file to upload which does get sent to the same id number when uploaded and can be viewed on the view contact page. When I try to view the uploaded file by trying to turn it into a link so the end user can download the file uploaded, I cannot seem to get the coding right. The file upload is named userfile. If anyone can tell me what I'm doing wrong, that would be awesome. It's the only glitch, the link not working! Sorry for such a long script, but I thought I should add all of it to this, and the problem is closer to the bottom.
start script
<?
if (!$_POST[id]) {
header( "Location: http://www.internationalyachtcrew.com/crewdb/pick_viewcontact.php");
exit;
} else {
session_start();
}
if ($_SESSION[valid] !="yes") {
header("Location: http://www.internationalyachtcrew.com/crewdb/contact_menu.php");
exit;
}
$db_name = "newport_crewdb";
$table_name = "my_joborders";
$connection = @mysql_connect("mysql03.secureserverdot.com", "newport_crewdb", "93clarkest")
or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "SELECT order_name, date_taken, yacht_name, build, itinerary, position, salary, amountcrew,
flag, private, nationality, tickets, visa, contactname, address, citystate, phone1,
phone2, email, startdate, comments, candidate1, candidate2, datesubmit1, datesubmit2, userfile
FROM $table_name WHERE id = '$_POST[id]'";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$order_name = $row['order_name'];
$date_taken = $row['date_taken'];
$yacht_name = $row['yacht_name'];
$build = $row['build'];
$itinerary = $row['itinerary'];
$position = $row['position'];
$salary = $row['salary'];
$amountcrew = $row['amountcrew'];
$flag = $row['flag'];
$private = $row['private'];
$nationality = $row['nationality'];
$tickets = $row['tickets'];
$visa = $row['visa'];
$contactname = $row['contactname'];
$address = $row['address'];
$citystate = $row['citystate'];
$phone1 = $row['phone1'];
$phone2 = $row['phone2'];
$email = $row['email'];
$startdate = $row['startdate'];
$comments = $row['comments'];
$candidate1 = $row['candidate1'];
$candidate2 = $row['candidate2'];
$datesubmit1 = $row['datesubmit1'];
$datesubmit2 = $row['datesubmit2'];
$userfile = $row['userfile'];
}
?>
<html>
<head>
<title>Yacht Job Orders Management System: View a Yacht</title>
</head>
<body><?
//put in the logo here?>
<h1>Yacht Job Order Sheet</h1>
<h2><em>Vessel Information</em></h2>
<form method="POST" ACTION="do_delcontact.php">
<input type="hidden" name="id" value="<? echo "$_POST[id]"; ?>">
<input type="hidden" name="yacht_name" value="<? echo "$_POST[yacht_name]"; ?>">
<input type="hidden" name="yacht_name" value="<? echo "$_POST[position]"; ?>">
<table cellspacing=3 cellpadding=3 width="540">
<tr>
<td valign=top>
<b>Order Taken By: </b>
<? echo "$order_name"; ?>
<b><br>
Name of Vessel:</b>
<? echo "$yacht_name"; ?> </b></td>
<td valign=top width="249">
<b>Date:</b>
<? echo "$date_taken"; ?>
<b> <br>
Build and Length: </b> <? echo "$build"; ?></td>
</tr>
</table>
<tr>
<td valign="top">
<b>Itinerary and location of Yacht:</b>
<? echo "$itinerary"; ?>
<table cellspacing=3 cellpadding=5 id="table1">
<!-- MSCellType="ContentBody" --></table>
<tr>
<td> </td>
<td valign="top">
<!-- MSCellType="ContentBody" -->
<table cellspacing=3 cellpadding=5 id="table1">
<tr>
<th>POSITION INFO</th>
<th>CONTACT INFO NEEDED</th>
</tr>
<tr>
<td valign=top>
<strong>Position Needed:</strong><br>
<? echo "$position"; ?></p>
<strong>Salary:</strong><br>
<? echo "$salary"; ?></p>
<p><strong>How Many Crew:</strong><br>
<? echo "$amountcrew"; ?></p>
<p><strong>Flag:</strong><br>
<? echo "$flag"; ?></p>
<p><strong>Private or Charter:</strong><br>
<? echo "$private"; ?></p>
<p><strong>Nationality:</strong><br>
<? echo "$nationality"; ?></p>
<p><strong>What Ticket including STCW:</strong><br>
<? echo "$tickets"; ?></p>
<p><b>Visa:</b><br>
<? echo "$visa"; ?></p>
</td>
<td valign=top>
<b>Name of Contact and Title:</b><br>
<? echo "$contactname"; ?><p><strong>Billing
Address:</strong><br>
<? echo "$address"; ?></p>
<p><strong>City/State/Postal Code Country:</strong><br>
<? echo "$citystate"; ?></p>
<p><strong>Phone 1:</strong><br>
<? echo "$phone1"; ?></p>
<p><strong>Phone 2:</strong><br>
<? echo "$phone2"; ?></p>
<p><strong>E-Mail Address:</strong><br>
<? echo "$email"; ?></p>
<p><strong>Start Date:</strong><br>
<? echo "$startdate"; ?><br>
<i><font size="2">YYYY-MM-DD</font></i></p>
</td>
</tr>
<tr>
<td align=center colspan=2><p align="left"><b>Comments:</b><br>
<? echo "$comments"; ?><br>
</td>
</tr>
</table>
<table cellspacing=3 cellpadding=3 id="table2">
<tr>
<td valign=top width="264">
Candidate1:
<? echo "$candidate1"; ?><br>
Date Submitted: <? echo "$datesubmit1"; ?></td>
<td valign=top>
<b> </b>Candidate2:
<? echo "$candidate2"; ?><br>
</b> Date Submitted: <? echo "$datesubmit2"; ?><b> </b>
<b>Userfile:
<? echo "$userfile"; ?><br>
echo " <tr>
<td align=\"left\"><a href=\"show_contact.php?id=['userfile']">{$row['userfile']}</a></td>
</td>
</tr>
</table>
<table cellspacing=3 cellpadding=5 id="table3" width="542">
<!-- MSCellType="ContentBody" -->
<tr>
<td align=center>
<p align="center"><br>
<br>
<p><a href="contact_menu.php">Return to Main Menu</a></p>
</td>
</tr>
</table>
</form>
</body>
</html>