Jump to content

Database wont update


BrianM

Recommended Posts

My database was updating just fine when I was using '<input type='text' />' but I noticed after changing it to a <textarea> instead, It wont insert my report. ???

 

Here is the code:

<?php
function report_create() {
	echo("<form action=\"".$_SERVER['PHP_SELF']."?table=".$_GET['table']."&project_name=".$_GET['project_name']."&report=create\" method=\"post\">");
	echo("<b><font size=\"2px\" face=\"Verdana\">Create report:<br /></font></b><textarea cols=\"40\" rows=\"7\" name=\"report_\"></textarea><br /><input type=\"submit\" name=\"report_create\" value=\"Create\" />");
	echo("</form>");
	}
if (isset($_POST['report_create'])) {
	mysql_connect('localhost', 'brian', '') or die(mysql_error());
	mysql_select_db('reports') or die(mysql_error());

	mysql_query("INSERT INTO `$table` (date, report) VALUES ('".date("m-d-y")."', '".$_POST['report_']."')");
	echo "<script> window.location.href = ''; </script>";
	exit;
}
?>

 

I kept all field names the same, as you can see. So I'm not sure why it wont work and I'm hoping somebody can point me in the right direction. :)

Link to comment
Share on other sites

I would first just trying your SQL statment in something like phpMyadmin (of course subsutiting variables for somewhat real values) to make sure there isn't an error in your sql statement if you're not getting a die statement

 

that sounds like where the problem is lying

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.