Avalanche Posted April 13, 2003 Share Posted April 13, 2003 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? Quote Link to comment https://forums.phpfreaks.com/topic/342-no-good-way-to-describe-it/ Share on other sites More sharing options...
Avalanche Posted April 13, 2003 Author Share Posted April 13, 2003 Wow, didn\'t expect a reply that fast. Sorry, I figured out my error, now this is happening. (in my edited post above) Quote Link to comment https://forums.phpfreaks.com/topic/342-no-good-way-to-describe-it/#findComment-1102 Share on other sites More sharing options...
Avalanche Posted April 13, 2003 Author Share Posted April 13, 2003 Hmm... I think I figured it out. Sorry for the trouble. Quote Link to comment https://forums.phpfreaks.com/topic/342-no-good-way-to-describe-it/#findComment-1103 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.