rainaajeet Posted March 10, 2008 Share Posted March 10, 2008 I have created a page through this code : <html> <title>Project Management</title> <body> <h1>            <u>Create New Project</u>     </h1> <form name="Enter New Task" action="addentry1.php" method="post"> <table width="20%" border="1"> <tr> <td width=45%><b><font face=arial size=2>Project Name</font></b></td>   <td><b><font face=arial size=2><input type="text" name= "proj_name" value="" > </font> </table> <br> <table width="100%" border="1"> <td><font size="-1"><b><font face="Arial,Helvetica,sans-serif">List of Tasks</font></b></font></td> <td><font size="-1"><b><font face="Arial,Helvetica,sans-serif">Assigned To</font></b></font></td> <td><font size="-1"><b><font face="Arial,Helvetica,sans-serif">Start Date</font></b></font></td> <td><font size="-1"><b><font face="Arial,Helvetica,sans-serif">End Date</font></b></font></td> <td><font size="-1"><b><font face="Arial,Helvetica,sans-serif">% Completion</font></b></font></body><body></td> </tr> <tr> <td><input type="text" name="list_of_task"></td> <td> <select name="assigned_to"> <option>Select</option> <option>Abhinesh Sethumadhavan</option> <option>Prabhu Hosmani</option> </select></td> <td><input type="text" name="start_date"></td> <td><input type="text" name="end_date"></td> <td><input type="text" name="completion_percent"></td> </tr> <input type="submit" name="submit"> </body> </html> I created a page where I can allow user to insert data into created database "peisd" and tablename "task" <html> <title> Welcome to Project Management Tool</title> <body bgcolor=ORANGE> <h1> Please Wait...The Database is being Updated</h1> <?php if($_POST['submit']== "submit") { //header("Content-Type: text/plain"); $proj_name = $_POST['proj_name']; $list_of_task = $_POST['list_of_task']; $assigned_to = $_POST['assigned_to']; $start_date = $_POST['start_date']; $end_date = $_POST['end_date']; $completion_percent = $_POST['completion_percent']; /* set's the variables for MySQL connection */ $server = "localhost:3306"; // this is the server address and port $username = "root"; // change this to your username $password = "mysql123"; // change this to your password /* Connects to the MySQL server */ $link = @mysql_connect ($server, $username, $password) or die (mysql_error()); /* Defines the Active Database for the Connection */ if (!@mysql_select_db("peisd", $link)) { echo "<p>There has been an error. This is the error message:</p>"; echo "<p><strong>" . mysql_error() . "</strong></p>"; echo "Please Contact Your Systems Administrator with the details"; } /* Passes a Query to the Active Database */ $result = mysql_query("INSERT INTO task ( proj_name,list_of_task,assigned_to,start_date,end_date,completion_percent) VALUES ('$proj_name','$list_of_task','$assigned_to','$start_date','$end_date','$completion_percent')", $link); if (!$result) { echo("<p>Error performing create query: " . mysql_error() . "</p>"); exit(); } mysql_close ($link); ?> </body> </html> But its not updating my database. Pls Help Link to comment https://forums.phpfreaks.com/topic/95357-unable-to-insert-form-data-into-the-database/ Share on other sites More sharing options...
soycharliente Posted March 11, 2008 Share Posted March 11, 2008 Try to echo the $_POST array to see if your values are even making it to the page that is processing them. Link to comment https://forums.phpfreaks.com/topic/95357-unable-to-insert-form-data-into-the-database/#findComment-489205 Share on other sites More sharing options...
vicodin Posted March 11, 2008 Share Posted March 11, 2008 I dont see a </form> in there... dont know how that would impact it going into the db but check it out Link to comment https://forums.phpfreaks.com/topic/95357-unable-to-insert-form-data-into-the-database/#findComment-489249 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.