Hi
I am having major problems with this php form that will upload data and an image to a mysql database.
The script seems to work after I press the submit form; I see all the data plus the image upload on the preview page, but when I check the mysql table, it is empty!
Here's what I have so far:
<?php
if ($submit) {
$db_name="mydb";
$table_name="mytable";
$connection = @mysql_connect("localhost", "mydb", "mypassword") or die ("Couldn't connect.");
$db= @mysql_select_db($db_name, $connection) or die("Couldn't select database.");
$sql = "INSERT INTO mytable SET
name = '$name',
city = '$city',
state = '$state',
email = '$email',
website = '$website',
area_code = '$area_code',
phone = '$phone',
hair = '$hair',
picture = '$picture',
picture_name ='$picture_name'";
exec("cp $picture /home/escorts/public_html/tranny/images/$picture_name");
echo "Name: $name<br>\n";
echo "City: $city<br>\n";
echo "State: $state<br>\n";
echo "Email: $email<br>\n";
echo "Website: $website<br>\n";
echo "Area Code: $area_code<br>\n";
echo "Phone: $phone<br>\n";
echo "Hair: $hair<br>\n";
echo "temp file: $picture<br>\n";
echo "file name: $picture_name<br>\n";
echo "file size: $picture_size<br>\n";
echo "file type: $picture_type<br>\n";
echo "<br>\n";
echo "<img src=images/$picture_name><br>\n";
}
?>
<form enctype="multipart/form-data" method="post"
action="<?php echo $PHP_SELF ?>"><p>
Name:
<input type="Text" name="name" size="25"></p><p>
City
<input type="Text" name="city" size="25"></p><p>
State
<input type="Text" name="state" size="2"></p><p>
Email
<input type="Text" name="email" size="25"></p><p>
Website
<input type="Text" name="website" size="25"></p><p>
Area Code
<input type="Text" name="area_code" size="3"></p><p>
Phone
<input type="Text" name="phone" size="8"></p><p>
Hair
<input type="Text" name="hair" size="8"></p><p>
picture
<input type="File" name="picture" size="25"></p>
<input type="submit" name="submit" value="Upload">
</form>