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

**URL:** <https://forum.kirupa.com/t/a-problem-with-php-form-insert-into-mysql-i-have-read-other-threads-still-problem/106294>\
**Category:** Uncategorized\
**Created:** [April 4, 2004, 7:20am UTC](https://forum.kirupa.com/t/a-problem-with-php-form-insert-into-mysql-i-have-read-other-threads-still-problem/106294 "2004-04-04T07:20:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamer](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@dreamer](https://forum.kirupa.com/u/dreamer)\
**Post date:** [April 4, 2004, 7:20am UTC](https://forum.kirupa.com/t/a-problem-with-php-form-insert-into-mysql-i-have-read-other-threads-still-problem/106294/1 "2004-04-04T07:20:35Z")

</div>

I have 2 files.

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

```auto

<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 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

```auto

<?
$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!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 10:55am UTC](https://forum.kirupa.com/t/a-problem-with-php-form-insert-into-mysql-i-have-read-other-threads-still-problem/106294/2 "2004-04-06T10:55:46Z")

</div>

KOOL! its working thanks!

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

```auto

<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>

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 12:20pm UTC](https://forum.kirupa.com/t/a-problem-with-php-form-insert-into-mysql-i-have-read-other-threads-still-problem/106294/3 "2004-04-06T12:20:57Z")

</div>

[http://uk.php.net/manual/en/function.filesize.php](http://uk.php.net/manual/en/function.filesize.php)

Try searching [php.net](http://php.net) next time :sure:

You cannot really work out the file type.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 2:39pm UTC](https://forum.kirupa.com/t/a-problem-with-php-form-insert-into-mysql-i-have-read-other-threads-still-problem/106294/4 "2004-04-06T14:39:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 7, 2004, 6:04pm UTC](https://forum.kirupa.com/t/a-problem-with-php-form-insert-into-mysql-i-have-read-other-threads-still-problem/106294/5 "2004-04-07T18:04:55Z")

</div>

> [@Vash](#):
>
> hey njs: Do you know why the mime\_content\_type function doesn’t work? Its on the [php.net](http://php.net) site: [http://us4.php.net/manual/en/function.mime-content-type.php](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 😉

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 7, 2004, 6:16pm UTC](https://forum.kirupa.com/t/a-problem-with-php-form-insert-into-mysql-i-have-read-other-threads-still-problem/106294/6 "2004-04-07T18:16:23Z")

</div>

> [@njs12345](#):
>
> 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 😉
> 
> offtopic: I’m in the middle of a regex tutorial 😃

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… 🙂
