i have been trying to insert data into my db,but it wont work.
can anyone tell me why,pls.
HTML form
<form action="insert.php?nav=mail" method="post" enctype=multipart/form-data>
<table width="100%" border="0" align="left" cellpadding="1" cellspacing="1" class="bodytxt">
<tr>
<td height="30" colspan="3" align="left" bgcolor="#999999"><strong><font color="#666666"> </font><span class="style2"><font color="#FFFFFF">Compose Mail </font></span> </strong></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><fieldset>
<legend><span class="style1">Recepent's Address </span></legend>
<table width="100%" border="0" cellpadding="1" cellspacing="1" class="bodytxt">
<tr>
<td width="29%" align="right">To: </td>
<td width="71%"><label>
<input name="username" type="text" id="username" class="bodytxt" size="60" maxlength="200" />
</label></td>
</tr>
<tr>
<td width="29%" align="right">Subject: </td>
<td><input name="title" type="text" id="title" class="bodytxt" size="60" /></td>
</tr>
</table>
</fieldset> </td>
</tr>
<tr>
<td height="203"><table width="90%" border="0" align="center" cellpadding="5" cellspacing="1" bordercolor="#666666" class="bodytxt" hspace="0">
<tr>
<td width="45%" height="196" align="center" valign="top"><fieldset>
<legend><span class="style1">Compose Mail Below</span></legend>
<label>
<textarea name="description" id="description" rows="10" cols="65"></textarea>
</label>
</fieldset></td>
</tr>
<tr>
<td height="28" align="center" valign="top"> </td>
</tr>
<tr>
<td height="28" align="center" valign="top"><input name="submit" type="submit" class="bodytxt" value="Send Massage" />
<input name="reset" type="reset" class="bodytxt" value="Cancel" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
Below is my insert.php
<?php
session_start();
$navtype = $_GET['nav'];
include "config.php";
?>
<?php
if($navtype == "mail")
{
$username = $_POST['username'];
$title = $_POST['title'];
$description = $_POST['description'];
$sql = ("INSERT INTO inbox (username, title, description, datesent, timesent)
VALUES('$username', '$title', '$description', NOW(), CURTIME(),") ;
mysql_query($sql);
echo "<center><p><br><br><br><strong>The new $title has been added to the database</strong></p></form>";
}
?>
MOD EDIT: When posting code, use CODE tags, not PHP tags or HTML tags!
This post has been edited by JackOfAllTrades: 19 February 2011 - 09:04 AM

New Topic/Question
Reply




MultiQuote







|