I am have a problem inserting into a database. Here is the source of the form page, I had to remove the css and javascript because it was to long:
Code:
<html><head><title>Compose Message</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<a name="TOP"></a>
<form action="../sendmail.php" method="post" name="compose" id="compose" onsubmit="return buttonPressed">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tbody><tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td colspan="2"><img src="composeAd_data/dot-blank.gif" height="8" width="1"></td>
<td colspan="2"><img src="composeAd_data/dot-blank.gif" height="8" width="1"><span class="text12">Basic Editor / HTML Editor </span></td>
</tr>
<tr>
<td colspan="5" nowrap="nowrap"><font class="head14"> Enter Recipients:</font>
<font class="text10"> Separate recipient names with commas.</font></td>
</tr>
<tr><td colspan="2"><img src="composeAd_data/dot-blank.gif" height="8" width="1"></td></tr>
<tr>
<td><font class="text10"> <b>To:</b> </font></td>
<td colspan="3"><font class="text10"><input class="textform" name="to" value="" size="65" type="text"></font></td>
<td valign="top"><a href="javascript:address()" onmouseover="window.status=''; return true;"><img src="composeBody_data/address.gif" alt="Address" border="0" height="18" hspace="10" width="62"></a></td>
</tr>
<tr><td colspan="4"><img src="composeAd_data/dot-blank.gif" height="3" width="1"></td></tr>
<tr>
<td><font class="text10"> <b>Cc:</b> </font></td>
<td><font class="text10"><input class="textform" name="cc" value="" size="27" type="text"></font></td>
<td><font class="text10"> <b>Bcc:</b> </font></td>
<td><font class="text10"><input class="textform" name="bcc" value="" size="26" type="text"></font></td>
<td></td>
</tr>
<tr><td colspan="2"><img src="composeAd_data/dot-blank.gif" height="8" width="1"></td></tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td><font class="head14"> Enter Subject: </font></td>
<td><font class="text10"><input class="textform" size="49" name="subject" value="" type="text"></font></td>
</tr>
<tr><td colspan="2"><img src="composeAd_data/dot-blank.gif" height="8" width="1"></td></tr>
</tbody></table>
<table border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td valign="bottom" width="150"><font class="head14"> Enter Message:</font></td>
<td align="right"><font class="textwarning" id="spck"> </font></td>
</tr>
<tr><td colspan="2"><img src="composeAd_data/dot-blank.gif" height="5" width="1"></td></tr>
<tr><td colspan="2"><font class="text10">
<textarea class="textform" cols="75" rows="18" name="body" wrap="virtual"></textarea></font></td></tr>
<tr><td colspan="2"><img src="composeAd_data/dot-blank.gif" height="8" width="1"></td></tr>
</tbody></table>
<font class="sw">
<input name="emaildate" type="hidden" value="<?php echo gmdate("mdYHis"); ?>">
</font>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr><td colspan="2"><img src="composeAd_data/dot-blank.gif" height="8" width="1"></td></tr>
<tr>
<td width="10%"><font class="head14" id="attach_label"> Attachments: </font></td>
<td width="90%"><font class="text12" id="attach_list">
<input name="attachment" type="file" id="attachment" size="45">
</font></td>
</tr>
<tr><td colspan="2"><img src="composeAd_data/dot-blank.gif" height="8" width="1"></td></tr>
</tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr><td colspan="2" class="bglight"><img src="composeAd_data/dot-blank.gif" height="1" width="1"></td></tr>
<tr valign="bottom" class="bgslight">
<td> </td>
<td align="right">
<input name="imageField" type="image" src="composeBody_data/send.gif" width="62" height="18" border="0">
<a href="javascript:window.close();" target="_parent" onmouseover="window.status=''; return true;"><img src="composeBody_data/cancel.gif" alt="Cancel" border="0" height="18" hspace="3" vspace="4" width="62"></a></td>
</tr>
<tr><td colspan="2" class="bgtabon"><img src="composeAd_data/dot-blank.gif" height="3" width="1"></td></tr>
<tr><td colspan="2">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
</table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</form>
</body></html>
and here is the code for the sendmail.php
PHP Code:
<?php
header("Location: compose.php");
// Connecting, selecting database
$link = mysql_connect('localhost', '', '')
or die('Could not connect: ' . mysql_error());
mysql_select_db('rrmail') or die('Could not select database');
$query_rs_insertmessages = "INSERT INTO tbl_messages (from, towho, ccwho, bccwho, subject, body, date) VALUES ('".$_COOKIE['unique']."', '".$_POST['to']."', '".$_POST['cc']."', '".$_POST['bcc']."', '".$_POST['subject']."', '".$_POST['body']."', '".$_POST['date']."');";
$re_insertmessages = mysql_query($query_rs_insertmessages);
?>
It does not give me and error it just uses the header function to go to compose.php page. and is does NOT INSERT INTO THE DATABASE. Could somebody please help?
Thanks,
Christian
Bookmarks