Jump to content


Photo

Form action

mysql post form

  • Please log in to reply
4 replies to this topic

#1 mindblown

mindblown

    Member

  • Members
  • PipPip
  • 16 posts

Posted 12 February 2013 - 03:34 PM

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...nsitional.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);

#2 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 12 February 2013 - 03:41 PM

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. 
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#3 mindblown

mindblown

    Member

  • Members
  • PipPip
  • 16 posts

Posted 12 February 2013 - 03:48 PM

what code tags and quotes around which strings

#4 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 12 February 2013 - 03:50 PM

The <> icon. 

http://php.net/manua...types.array.php
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#5 mindblown

mindblown

    Member

  • Members
  • PipPip
  • 16 posts

Posted 12 February 2013 - 03:59 PM

do you mean <?php ?> because i put those i just forgot them in the copy paste




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com