Jump to content

No good way to describe it


Avalanche

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/342-no-good-way-to-describe-it/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.