mindblown Posted February 12, 2013 Share Posted February 12, 2013 Im trying to upload a file into my table in mysql and it giving me this error " Notice: Undefined index: pictu in C:\wamp\www\closer\get.php on line 13" I know this is basic stuff but i don't understand the error and why its giving me it. Any help would be great. //////////////////// the index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <form action="get.php" method="post" enctype="multipart/form-data"> <input type="text" name="title" /><br/> <input type="file" name="Pictu" /><br/> <input type="submit" name="Sumber" value="ClickClack" /> </form> </html> //////////////////////// the get.php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("project", $con); $sql="INSERT INTO media (Name, pic) VALUES ('$_POST[title]','$_POST[pictu])"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); Quote Link to comment https://forums.phpfreaks.com/topic/274413-form-action/ Share on other sites More sharing options...
Jessica Posted February 12, 2013 Share Posted February 12, 2013 1. This is the wrong forum, I'm moving your post. 2. Use code tags on your code. 3. Put quotes around your strings. 4. Check if the form has been posted before trying to use the $_POST array. Quote Link to comment https://forums.phpfreaks.com/topic/274413-form-action/#findComment-1412056 Share on other sites More sharing options...
mindblown Posted February 12, 2013 Author Share Posted February 12, 2013 what code tags and quotes around which strings Quote Link to comment https://forums.phpfreaks.com/topic/274413-form-action/#findComment-1412060 Share on other sites More sharing options...
Jessica Posted February 12, 2013 Share Posted February 12, 2013 The <> icon. http://php.net/manual/de/language.types.array.php Quote Link to comment https://forums.phpfreaks.com/topic/274413-form-action/#findComment-1412062 Share on other sites More sharing options...
mindblown Posted February 12, 2013 Author Share Posted February 12, 2013 do you mean <?php ?> because i put those i just forgot them in the copy paste Quote Link to comment https://forums.phpfreaks.com/topic/274413-form-action/#findComment-1412065 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.