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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.