Excuse my ignorance...if i have a page that is submitting data from a form into a db and i have it <form....action="upload.php"> will a <?php if(isset($submit)){ still work later on down the page? Here is the sloppy/newbie codes....
<head><title></title>
</head>
<body>
<form enctype="multipart/form-data" method="post" action="up_go.php">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000">
name<br>
<input type="Text" name="name" size="25">
<br>
description<br>
<input type="Text" name="description" size="25">
<br>
price<br>
<input type="Text" name="price" size="25">
<br>
<td>file upload</td>
<td></td>
</tr>
<tr>
<td>file: </td>
<td><input type="File" name="userfile" size="30" maxlength="255">
</td>
</tr>
<tr>
<td>target filename: </td>
<td><input type="Text" name="image_name" size="30" maxlength="255">
</td>
</tr>
<tr>
<tr>
<td>upload diretory: </td>
<td>c:\program files\apache group\realdocs\files\antiquesbasic\images</td>
</tr>
<td colspan="2" align="CENTER">
<INPUT TYPE="submit" VALUE="upload">
</td>
</tr>
</FORM>
<?php
if (isset($submit)) {
$db = mysql_connect("localhost","root");
mysql_select_db("antiques",$db);
$sql = "INSERT INTO info (name,description,price,image_name) ".
"VALUES ('$name,$description,$price,$image_name')";
exec( "cp $image //localserver/files/images/$image_name");
?>
</body>
and the up_go.php (action of form)...
<?php
function do_upload($filename,$image_name) {
$file = basename($filename);
$tmp_upload_path = "c:\windows\";
$new_file_name = "c:\program files\apache group\realdocs\files\antiquesbasic\images\".$image_name;
if (!copy($tmp_upload_path.$file, $new_file_name)) echo "failed to copy file<br>\n";
return;
}
?>
<HEAD>
<TITLE>PHP - file upload</TITLE>
<style type="text/css">
<!--
body { font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
-->
</style>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<?php
do_upload($userfile,$image_name);
?>
<TABLE>
<TR>
<TD>upload report</TD><TD></TD>
</TR>
<TR>
<TD>upload tmp file:</TD><TD><?php echo $userfile; ?></TD>
</TR>
<TR>
<TD>file name:</TD><TD><?php echo $userfile_name; ?></TD>
</TR>
<TR>
<TD>target file name:</TD><TD><?php echo $image_name; ?></TD>
</TR>
<TR>
<TD>target directory:</TD><TD>c:\apache\htdocs\tmp</TD>
</TR>
<TR>
<TD>file size:</TD><TD><?php echo $userfile_size; ?></TD>
</TR>
<TR>
<TD>file type:</TD><TD><?php echo $userfile_type; ?></TD>
</TR>
<TR>
<TD>Name</TD><TD><?php echo $name; ?></TD>
</TR>
<TR>
<TD>Description:</TD><TD><?php echo $description; ?></TD>
</TR>
<TR>
<TD>Price:</TD><TD><?php echo $price; ?></TD>
</TR>
</TABLE>
</BODY>
thanks for any help.... it spits out the information fine in the up_go.php resultant page but i doubt that it is actually getting into the db????