Yes I do.
I have a form:
//display the data in a form
echo "<form enctype=\"multipart/form-data\" METHOD=\"POST\" action=\"editarticle.php\">\n";
echo "<table>\n";
echo "<tbody>\n";
//hidden file size
echo "<tr><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1000\">\n";
echo "<td>Associate with Module:</td>\n";
echo "<td><select NAME=\"cboAssocModule\" TABINDEX=0>\"$option_block\"</select></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Active: </td>\n";
if ($article[active]==0)
{
echo "<td> <input TYPE=\"checkbox\" checked=\"unchecked\" NAME=\"chkActive\" TABINDEX=1></td>\n";
}
elseif ($article[active]==1)
{
echo "<td> <input TYPE=\"checkbox\" checked=\"checked\" NAME=\"chkActive\" TABINDEX=1></td>\n";
}
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Title:</td>\n";
echo "<td> <input TYPE=\"text\" size=60 maxlength=128 NAME=\"txtTitle\" value=\"$article[title]\" TABINDEX=2></td>\n";
echo "<input TYPE=\"hidden\" NAME=\"cboModules\" value=\"$mod_id\">";
echo "<input TYPE=\"hidden\" NAME=\"article_id\" value=\"$article_id\">";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Body:</td>\n";
//strip any tags from text
$body = strip_tags($article[content]);
//strip any slashes from text
$body = stripslashes($body);
echo "<td><textarea Name=\"txtBody\" cols=60 rows=20 TABINDEX=3>$body</textarea></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Image:</td>\n";
echo "<td><input TYPE=\"file\" NAME=\"txtImageFile\" size=60 maxlength=128 value=\"$article[image_path]\" TABINDEX=4></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Image:</td>\n";
echo "<td><img src=\"$article[image_path]\" ><br><b><i>$article[image_path]</i></b></td>";
//hidden variable to move the current image path if one exists
echo "<input TYPE=\"hidden\" NAME=\"CurrentImagePath\" value=\"$article[image_path]\">";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Link:</td>\n";
$link=stripslashes($article[read_more_link]);
echo "<td><input TYPE=\"text\" NAME=\"txtLink\" size=60 maxlength=128 value=\"$link\" TABINDEX=6></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<td><input TYPE=\"submit\" value =\"submit\" name=\"submit_style\" TABINDEX=7></td>\n";
echo "</tr>\n";
echo "</tbody>\n";
echo "</table>\n";
echo "<br>\n";
echo "<br>\n";
echo "</form>\n";
<b>and the receiving php script: editarticle .php </b>
//test for a new image upload
//if no new image is assigned
//use the existing file from the db
if ($txtImageFile=="none")
{
$upfile = $CurrentImagePath;
}
else
{
//based on the first letter of the uploaded file
//defines where it gets put
//updir is the a-z directory
$updir=substr($txtImageFile_name,1,1);
echo "UploadDir=".$upfile"\n";
//upfile is the whole path to upload the file
$upfile = "/home/images/uploaded/$updir/".$txtImageFile_name;
if ( !copy($txtImageFile, $upfile))
{
echo "Problem: Could not move file into directory";
exit;
}
else
echo "File uploaded successfully<br><br>";
}
//connect to database
$mysql_db_conn = db_connect();
echo "building sql INSERT <br>";
if ($chkActive == "on")
{
$chkActive = 1;
}
else
{
$chkActive = 0;
}
$txtTitle=addslashes($txtTitle);
//$txtBody=addslashes($txtBody);
$txtBody=nl2br($txtBody);
$txtImage=addslashes($txtImage);
$txtLink=addslashes($txtLink);
echo "active = ".$chkActive."\n<br>";
$sql= "update articles set title='$txtTitle',module_id=$cboAssocModule, content='$txtBody', "
." image_path='$upfile',active=$chkActive,read_more_link='$txtLink' "
." WHERE article_id=$article_id and module_id=$cboModules ";
echo "UPDATE sql = ".$sql."\n<br>";
// execute SQL query and get result
$sql_result = mysql_query($sql,$mysql_db_conn) or die("Couldn't execute query." .mysql_error());
?>
The variabels are all empty...
it worked until I added the file upload..
not sure why.
Regards
Russ