Get simple html text field to post to mysql database

I feel dumb asking this question. I'm having a heck of a time trying to get a simple one text field in an html form to pass over to the MySql database via PHP. The id and date_time field are getting inserted but the text from the form text field isn't.

Here is what I got.


<form action="php/comments.php" method="post" />
<input type="text" id="comment" />
<input type="submit" class="submit" value=" Submit Comment " />



mysqli_query($db_conx, "INSERT INTO comments(comment, date_time) 

header ("location: form.html");



Like I said the "id" which is set up as AUTO_INCREMENT and "date_time" rows are getting inserted. Comment, however, is coming up blank even though something was typed into the form.

Any help/ideas would be greatly appreciated. Can't quite figure out what I'm missing.


You need the name="blahblah" attribute when submitting forms.

On the PHP side, the name is how PHP receives the variable's "key" (var name) and then the field contents are the variable's value.

On the HTML side:

<input type="text" id="comment" name="myvarname" />

On the PHP side:


    $comment = $_POST['myvarname'];

Need Your Help

Visual Studio 2010 - Organising Web Application Layout on a Component Level

c# web-applications rest

I was wondering how to go about organising components on a c# web application in Visual Studio.

UIGraphicsGetImageFromCurrentImageContext counterpart in desktop Cocoa?

objective-c ios cocoa core-graphics

I'm trying to crate a simple Mac paint application. On iOS I used UIGraphicsGetImageFromCurrentImageContext to update a UIImageView's image when touchesMoved. I'm now trying to active the same thin...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.