A problem with php form insert into mysql. I HAVE READ OTHER THREADS! STILL PROBLEM!

I have 2 files.

submit.html ************************************


<html>
<head>
<title>New Submissions</title>
</head>

<body>
<form method="post" action="add.php">
<input type="hidden" name="id" value="null">
<input type="hidden" name="reviewed" value="no">
<input type="hidden" name="accepted" value="no">
<table>
<tr><td align="left">Name</td>
<td><input name="name" maxlength="255"></td>
</tr>
<tr><td align="left">Site name</td>
<td><input name="site_name" maxlength="255"></td>
</tr>
<tr><td align="left">Url</td>
<td><input name="url" maxlength="255"></td>
</tr>
<tr><td align="left">Email</td>
<td><input name="email" maxlength="255"></td>
</tr>
<tr><td colspan="2">

<input type="submit" value="submit">
</td>
</tr>
</table>
</form>
</body>
</html>


add.php **************************************


<?
$DBhost = "localhost";
$DBuser = "designers_hub";
$DBpass = "";
$DBName = "designers_hub";
$table = "link_submissions";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");

@mysql_select_db("$DBName") or die("Unable to select
database $DBName");

$sqlquery = "INSERT INTO $table
VALUES('$id','$name','$site_name','$url','$email','$reviewed','$accepted')";

$results = mysql_query($sqlquery);

mysql_close();

?>


It will only enter in a new record with no information. I get this:
Notice: Undefined variable: id in c:\program files\apache group\apache\htdocs\link_submission\add.php on line 13

Notice: Undefined variable: name in c:\program files\apache group\apache\htdocs\link_submission\add.php on line 13

Notice: Undefined variable: site_name in c:\program files\apache group\apache\htdocs\link_submission\add.php on line 13

Notice: Undefined variable: url in c:\program files\apache group\apache\htdocs\link_submission\add.php on line 13

Notice: Undefined variable: email in c:\program files\apache group\apache\htdocs\link_submission\add.php on line 13

Notice: Undefined variable: reviewed in c:\program files\apache group\apache\htdocs\link_submission\add.php on line 13

Notice: Undefined variable: accepted in c:\program files\apache group\apache\htdocs\link_submission\add.php on line 13

Whats going on??
Thanks hope you can help!

KOOL! its working thanks!

ALSO with uploading files, how do you get the size type and size?


<html>
<head>
<title>New Submissions</title>
</head>

<body>
<form method="post" action="add.php" enctype="multipart/form-data">
<input type="hidden" name="id" value="null">
<input type="hidden" name="file_type">
<input type="hidden" name="file_size">
<input type="hidden" name="reviewed" value="no">
<input type="hidden" name="accepted" value="no">
<table>
<tr><td width="88" align="left">Name</td>
<td width="339"><input name="name"></td>
</tr>
<tr><td align="left">Artwork name</td>
<td><input name="artwork_name"></td>
</tr>
<tr><td align="left">Upload File</td>
  <td><input type="file" name="file"></td>
</tr>
<tr><td colspan="2">

<input type="submit" value="submit">
</td>
</tr>
</table>
</form>
</body>
</html>

http://uk.php.net/manual/en/function.filesize.php

Try searching php.net next time :sure:

You cannot really work out the file type.

hey njs: Do you know why the mime_content_type function doesn’t work? Its on the php.net site: http://us4.php.net/manual/en/function.mime-content-type.php but its not included in any PHP release that I have tested…

hmm… well, it refers to a file called magic.mime - perhaps it isn’t included by default in the PHP release?

In my Gentoo Linux installation that file is there - I remember wondering what it was doing when I was configuring it :wink:

offtopic: I’m in the middle of a regex tutorial :smiley:

Yeah I think you’re right. I should just add that extension…

Awesome. Can’t wait to see that tutorial… I just started playing with regex again for the CMS that I am rebuilding… :slight_smile: