# Php sending blank data to database

**URL:** <https://forum.kirupa.com/t/php-sending-blank-data-to-database/105625>\
**Category:** Uncategorized\
**Created:** [March 28, 2004, 2:25am UTC](https://forum.kirupa.com/t/php-sending-blank-data-to-database/105625 "2004-03-28T02:25:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@nobody](https://forum.kirupa.com/u/nobody)\
**Post date:** [March 28, 2004, 2:25am UTC](https://forum.kirupa.com/t/php-sending-blank-data-to-database/105625/1 "2004-03-28T02:25:39Z")

</div>

Well I just starting PHPing and I’m having massive problems.

I followed a very faulty tutorial and spent like 2 hours just trying to figure out what they left out and how to fix it. After accomplishing that I realized that this thing barely works.  
Basically this code is supposed to enter a new row in a table called links but it just enters a blank row every time, so I’m pretty sure it’s the mysql query that’s messing it up, but I don’t know how to fix it… i’ve been php.net-ing and toying for a good hour but just cant get it  
here’s my code

```php
<?php
if($_POST['wasPressed']) //If submit is hit
{
	mysql_connect("localhost","removed","removed"); //then connect as user
	mysql_select_db("removed"); //select which database you want to edit
	$_POST['name'] = $name;
	$_POST['href'] = $href;
	$_POST['alt'] = $alt;
	$_POST['class'] = $class;
	$result = MYSQL_QUERY("INSERT INTO links (ID,name,href,alt,class) VALUES ('NULL','$name','$href','$alt','$class')"); 
	if (!$result) {
    die('Invalid query: ' . mysql_error());
	}
	//Insert the values into the correct database
	print "<p>Information Succesfully Sent to Database</p>";
	//Get a conformation that it has been uploaded
} else {
?>
<form method="post" action="linkForm.php">
<TABLE>
<TR>
<TD>Title of Link:</TD>
<TD><INPUT TYPE="hidden" VALUE="1" NAME="wasPressed"><INPUT TYPE='TEXT' NAME='name' size=60></TD>
</TR>
<TR>
<TD>Link href:</TD>
<TD><INPUT TYPE='TEXT' NAME='href' size=60></TD>
</TR><br>
<TR>
<TD>Alternate Text:</TD>
<TD><INPUT TYPE='TEXT' NAME='alt' size=60></TD>
</TR>
<TR>
<TD>Class:</TD>
<TD><INPUT TYPE='TEXT' NAME='class' size=60></TD>
</TR><br>
<TR>
<TD></TD><br>
<TD><p><INPUT TYPE="SUBMIT" value="Send Information"></TD> 
</TR>
</TABLE>
</form>
<?php
} //close the else statement
?>

```
