I hope someone can help me, I can't figure
out what's wrong with my code.
I'm using php3.
I have an html form where I ask the user
to enter a filename to upload, then
fill in other pertinent details, when they
press the submit button - the file won't
upload and I was getting an error...
"uninitalized variable..." for every variable
that I was trying to reference from my
form (ie $Name, $Address, $City etc.). This
code then emails me the contents on each
field.
So, I thought I'd change it to see if the
variables were empty or not and now not
only is the file still not uploading,
the variables when I view my email
contain nothing.
Any help would be appreciated.
Below is my code.....
<?php
/****************************************/
/* SET FILE UPLOAD DIRECTORY */
/****************************************/
$UploadDir = "e:\\inetpub\\wwwroot\\bct\\wotw\\";
/****************************************/
/* APPEND DIR TO FILENAME */
/****************************************/
$UploadFile1 = $UploadDir . $File1_name;
if (! empty($File2_name))
{
$UploadFile2 = $UploadDir . $File2_name;
}
if (! empty($File3_name))
{
$UploadFile3 = $UploadDir . $File3_name;
}
/****************************************/
/* UPLOAD SELECTED FILES */
/****************************************/
if ($File1 != "none")
{
copy ($File1, $UploadFile1);
}
if ($File2 != "none")
{
copy ($File2, $UploadFile2);
}
if ($File3 != "none")
{
copy ($File3, $UploadFile3);
}
/****************************************/
/* GET FIELD INFO AND SAVE TO VARIABLE */
/****************************************/
$sTemp = "";
/****************************************/
/* FIELD - FILE1 */
/****************************************/
if (! empty($File1_name))
{
$sTemp .= "File Name 1 : \t $File1_name \r";
}
else
{
$sTemp .= "File Name 1 : \r";
}
/****************************************/
/* FIELD - CATEGORY1 */
/****************************************/
if (! empty($Category1))
{
$sTemp .= "Category 1 : \t $Category1 \r";
}
else
{
$sTemp .= "Category 1 : \r";
}
/****************************************/
/* FIELD - SYNOPSIS1 */
/****************************************/
if (! empty($Synopsis1))
{
$sTemp .= "Synopsis 1 : \t $Synopsis1 \r\r";
}
else
{
$sTemp .= "Synopsis 1 : \r\r";
}
/****************************************/
/* FIELD - FILE2 */
/****************************************/
if (! empty($File2_name))
{
$sTemp .= "File Name 2 : \t $File2_name \r";
}
else
{
$sTemp .= "File Name 2 : \r";
}
/****************************************/
/* FIELD - CATEGORY2 */
/****************************************/
if (! empty($Category2))
{
$sTemp .= "Category 2 : \t $Category2 \r";
}
else
{
$sTemp .= "Category 2 : \r";
}
/****************************************/
/* FIELD - SYNOPSIS2 */
/****************************************/
if (! empty($Synopsis2))
{
$sTemp .= "Synopsis 2 : \t $Synopsis2 \r\r";
}
else
{
$sTemp .= "Synopsis 2 : \r\r";
}
/****************************************/
/* FIELD - FILE3 */
/****************************************/
if (! empty($File3_name))
{
$sTemp .= "File Name 3 : \t $File3_name \r";
}
else
{
$sTemp .= "File Name 3 : \r";
}
/****************************************/
/* FIELD - CATEGORY3 */
/****************************************/
if (! empty($Category3))
{
$sTemp .= "Category 3 : \t $Category3 \r";
}
else
{
$sTemp .= "Category 3 : \r";
}
/****************************************/
/* FIELD - SYNOPSIS3 */
/****************************************/
if (! empty($Synopsis3))
{
$sTemp .= "Synopsis 3 : \t $Synopsis3 \r\r";
}
else
{
$sTemp .= "Synopsis 3 : \r\r";
}
/****************************************/
/* FIELD - NAME */
/****************************************/
if (! empty($Name))
{
$sTemp .= "Name : \t $Name \r";
}
else
{
$sTemp .= "Name : \r";
}
/****************************************/
/* FIELD - ADDRESS */
/****************************************/
if (! empty($Address))
{
$sTemp .= "Address : \t $Address \r";
}
else
{
$sTemp .= "Address : \r";
}
/****************************************/
/* FIELD - CITY */
/****************************************/
if (! empty($City))
{
$sTemp .= "City : \t $City \r";
}
else
{
$sTemp .= "City : \r";
}
/****************************************/
/* FIELD - STATE/PROV */
/****************************************/
if (! empty($StateProv))
{
$sTemp .= "State/Prov : \t $StateProv \r";
}
else
{
$sTemp .= "State/Prov : \r";
}
/****************************************/
/* FIELD - ZIP/POSTAL */
/****************************************/
if (! empty($ZipPostal))
{
$sTemp .= "Zip/Postal : \t $ZipPostal \r";
}
else
{
$sTemp .= "Zip/Postal : \r";
}
/****************************************/
/* FIELD - COUNTRY */
/****************************************/
if (! empty($Country))
{
$sTemp .= "Country : \t $Country \r";
}
else
{
$sTemp .= "Country : \r";
}
/****************************************/
/* FIELD - HOME PHONE */
/****************************************/
if (! empty($HomePhone))
{
$sTemp .= "Home Phone : \t $HomePhone \r";
}
else
{
$sTemp .= "Home Phone : \r";
}
/****************************************/
/* FIELD - OFFICE PHONE */
/****************************************/
if (! empty($OfficePhone))
{
$sTemp .= "Office Phone: \t $OfficePhone \r";
}
else
{
$sTemp .= "Office Phone: \r";
}
/****************************************/
/* FIELD - EMAIL */
/****************************************/
if (! empty($EmailAddress))
{
$sTemp .= "E-mail : \t $EmailAddress \r";
}
else
{
$sTemp .= "E-mail : \r";
}
/****************************************/
/* FIELD - NO NAME */
/****************************************/
if (! empty($NoName))
{
$sTemp .= "No Name : \t $NoName \r";
}
else
{
$sTemp .= "No Name : \r";
}
/****************************************/
/* FIELD - ACCEPT TERMS */
/****************************************/
if (! empty($AcceptTerms))
{
$sTemp .= "AcceptTerms : \t $AcceptTerms \r";
}
else
{
$sTemp .= "AcceptTerms : \r";
}
/****************************************/
/* FIELD - DONT ACCEPT TERMS */
/****************************************/
if (! empty($DontAcceptTerm))
{
$sTemp .= "DontAccept : $DontAcceptTerms \r";
}
else
{
$sTemp .= "DontAccept : \r\r";
}
/****************************************/
/* CONSTRUCT & SEND EMAIL TO WOTW */
/****************************************/
$mailto = "kathyc@bserv.com";
$subject = "New File Submission";
$replyto = "Reply-To:";
mail ($mailto, $subject, $sTemp, $replyto);
/****************************************/
/* SEND A RETURN PAGE TO USER */
/****************************************/
print "\n";
print "<head>\n";
print "<title>Writers On The Web - Submission Reply</title>\n";
print "</head>\n\n";
print "<body topmargin=0 leftmargin=8 marginwidth=8 marginheight=0 background='http://writersontheweb.com/wotw_images/bckg4.gif'>\n\n";
print "<!! === GRAPHICS FOR WEB PAGE === !!>\n";
print "<table border=0 width=641 cellpadding=0 cellspacing=0>\n";
print "<tr>\n";
print " <td colspan=4>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/spacer.gif' width=641 height=7><br>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/top1.jpg' width=641 height=88></td>\n";
print "</tr>\n\n";
print "<tr>\n";
print " <td><img border=0 src='http://writersontheweb.com/wotw_images/top2a.jpg' width=124 height=32></td>\n";
print " <td width=18><img border=0 src='http://writersontheweb.com/wotw_images/top2b.jpg' width=18 height=32></td>\n";
print " <td width=473></td>\n";
print " <td align=right width=26><img border=0 src='http://writersontheweb.com/wotw_images/toprght.gif' width=26 height=32></td>\n";
print "</tr>\n\n";
print "<tr>\n";
print " <td width=124 valign=top>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/top3.gif' width=124 height=52><br>\n\n";
print " <a href='index.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b1a.gif' width=124 height=25><br></a>\n\n";
print " <a href='submit_submit.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b3b.gif' width=124 height=26><br></a>\n\n";
print " <a href='submit_category.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b11a.gif' width=124 height=26></a><br>\n\n";
print " <a href='submit_pricing.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b4a.gif' width=124 height=26></a><br>\n\n";
print " <a href='submit_contract.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b5a.gif' width=124 height=42><br></a>\n\n";
print " <a href='submit_faqs.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b10a.gif' width=124 height=26></a><br>\n\n";
print " <a href='submit_profile.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b6a.gif' width=124 height=26></a><br>\n\n";
print " <a href='submit_contact.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b7a.gif' width=124 height=22></a><br>\n\n";
print " <a href='home_abc.htm'>\n";
print " <img border=0 src='http://writersontheweb.com/wotw_images/b8a.gif' width=124 height=42></a><br><br>\n";
print " </td>\n\n";
print " <td width=517 colspan=3 valign=top align=center>\n\n";
print " <!! === SUBMISSION HEADING === !!>\n";
print " <table border=0 cellpadding=0 cellspacing=0 width=464>\n";
print " <tr>\n";
print " <td>\n";
print " <p align=center><img border=0 src='http://writersontheweb.com/wotw_images/hdsubfrm.gif' width=280 height=37></p>\n";
print " </td>\n";
print " </tr></table>\n\n";
print " <!! === THANK YOU FOR YOUR SUBMISSION == !!>\n";
print " <br><br>\n";
print " <table border=0 align=center cellpadding=0 cellspacing=0 width=464>\n";
print " <tr>\n";
print " <td align=center>\n";
print " <p><font face='Arial' size=3>\n";
print " Thank you for your submission<br>$Name.\n\n";
print " </font>\n\n";
print " </td>\n";
print " </tr></table>\n\n";
print " <!! === BOTTOM LINKS === !!>\n";
print " <div align=center>\n";
print " <center>\n\n";
print " <br><br><br><br>\n";
print " <table border=0 cellpadding=0 cellspacing=0 width=493>\n";
print " <tr>\n";
print " <td align=center><font color='#000000'>\n";
print " <a href='index.htm'><font size=1 face='Arial' color='#000000'>Home</font></a><font size='1' face='Arial'> \n";
print " | </font><a href='submit_submit.htm'><font size=1 face='Arial' color='#000000'>Submit</font></a><font size=1 face='Arial'> \n";
print " | </font></font><font size=1 face='Arial' color='#DB8400'>Submission\n";
print " Form </font><font color='#000000'><font size=1 face='Arial'>\n";
print " | </font><a href='submit_category.htm'><font size=1 face='Arial' color='#000000'>Categories</font></a><font size=1 face='Arial'> \n";
print " | </font><a href='submit_pricing.htm'><font size=1 face='Arial' color='#000000'>Pricing</font></a><font size=1 face='Arial'> \n";
print " | </font><a href='submit_contract.htm'><font size=1 face='Arial' color='#000000'>Submission\n";
print " Contract</font></a><font size=1 face='Arial'> </font></font><font size=1 face='Arial'>\n";
print " | </font><a href='submit_faqs.htm'><font size=1 face='Arial' color='#000000'>FAQ's</font></a><font size=1 face='Arial'> </font></td>\n";
print " </tr>\n\n";
print " <tr>\n";
print " <td align=center><font color='#000000'><font size=1 face='Arial'> </font><a href='submit_profile.htm'><font size=1 face='Arial' color='#000000'>About\n";
print " Us</font></a></font><font color='#808080'> </font><font size=1 face='Arial' color='#000000'> | \n";
print " </font><font color='#000000'><a href='submit_contact.htm'><font size=1 face='Arial' color='#000000'>Contact\n";
print " Us</font></a></font><font size=1 face='Arial'> </font><font size=1 face='Arial' color='#000000'> | \n";
print " </font><a href='home_writers.htm'><font size=1 face='Arial' color='#000000'>Writers\n";
print " on the Web</font></a><font size=1 face='Arial'> </font><font size=1 face='Arial' color='#000000'> | </font><font size=1 face='Arial'>\n";
print " </font><a href='home_abc.htm'><font size=1 face='Arial' color='#000000'>WritersABC\n";
print " Library</font></a>\n";
print " </td>\n";
print " </tr></table>\n\n";
print " </div>\n";
print " <p> \n";
print "</td>\n";
print "</tr></table>\n\n";
print "</body>\n";
print "\n";
/****************************************/
/* E N D O F F I L E */
/****************************************/
?>