Jump to content


Photo

No good way to describe it


  • Please log in to reply
2 replies to this topic

#1 Avalanche

Avalanche
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 13 April 2003 - 07:43 PM

Here is my code: [php:1:992c85bc03]<?
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:

if (empty($petname)) {

echo (\"<b>You forgot to fill out your pet\'s name!</b><br>Please <a href=\"javascript:history.back()\">go back</a> and fix your error!\");
exit($end);

}

elseif (empty($description)) {

echo (\"<b>You forgot to fill out a short decsription/bio for your pet!</b><br>Please <a href=\"javascript:history.back()\">go back</a> and fix your error!\");
exit($end);

}

elseif (empty($imagefile)) {

echo \"<b>You forgot to upload an image for your pet!</b><br>Please <a href=\"javascript:history.back()\">go back</a> and fix your error!\";
exit($end);

}


$filename = $_FILES[\'imagefile\'][\'name\'];
if (file_exists(\'pets/\' . $filename)) {

echo \"<b>That image name already exists!<br>Rename your image and try submitting it again.</b><br>Please <a href=\"javascript:history.back()\">go back</a> and fix your error.\";
exit($end);

}

if ($_FILES[\'imagefile\'][\'type\'] == \"image/pjpeg\"){

copy ($_FILES[\'imagefile\'][\'tmp_name\'], \"pets/\".$_FILES[\'imagefile\'][\'name\'])
or exit (\"<b>ERROR!</b>$end\");

echo \"\";
echo \"Your pet has been uploaded sucessfully!</b><br>\";
echo \"<b>Pet\'s Name:</b> <u>$petname</u><br>\";
echo \"<b>Short Description/Bio:</b> <u>$description</u><br>\";
echo \"<b>Image Name:</b> <u>\".$_FILES[\'imagefile\'][\'name\'].\"</u><br>\";
echo \"Please keep in mind that your image must<br>be approved by a moderator first!\";

//adds to list

$petname = $_POST[\'petname\'];
$description = $_POST[\'description\'];
$ip = $_SERVER[\'REMOTE_ADDR\'];

$db = mysql_connect(localhost,burnttoa_pets,<mypass>);
mysql_select_db (burnttoa_hrah) or die (\"Cannot connect to database\");
/* We have now connected, unless you got an error message */
$query = \"INSERT INTO pets(name, bio, image, date, ip)
VALUES($petname,$description,$filename,now(),$ip)\";
mysql_query($query);
echo \"<b>Your entry has been successfully added.</b><p>\";

mysql_close($db);

}
}

?>[/php:1:992c85bc03]

Nothing shows up, it\'s just blank, and nothing gets added to the database. Help?
DEFINE("YOU","Spending Too Much Time On The Computer");

#2 Avalanche

Avalanche
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 13 April 2003 - 07:49 PM

Wow, didn\'t expect a reply that fast. Sorry, I figured out my error, now this is happening. (in my edited post above)
DEFINE("YOU","Spending Too Much Time On The Computer");

#3 Avalanche

Avalanche
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 13 April 2003 - 07:54 PM

Hmm... I think I figured it out. Sorry for the trouble.
DEFINE("YOU","Spending Too Much Time On The Computer");




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users