Hello,
I am having problems submitting data from a form.
Bassically, the form works fine, UNTILL I add a field at the end of the table in my MySQL database called rq_report. When I add the field, the data from the form fails to get added to the database.
Here is the code I currently use to submit the form :
<?PHP
$ip = getenv ( 'REMOTE_ADDR' );
$domain = GetHostByName($REMOTE_ADDR);
$done = "";
if ( $_POST['submit'] )
{
if (!$POST['name'])
{
$done = "Please enter your habboname...";
}
elseif (!$POST['artist'])
{
$done = "Please enter an artist name...";
}
elseif (!$_POST['title'])
{
$done = "Please enter a song title...";
}
else
{
$date = date("Y-m-d H:i:s");
$db = mysql_connect("*****", "*****", "*****");
mysql_select_db("nsfm_nsfmsite", $db);
mysql_query("INSERT INTO tm_requests VALUES ('', '{$_POST['name']}', '{$_POST['artist']}', '{$_POST['title']}', '{$_POST['messege']}', '{$ip}', '{$date}')", $db);
$_POST['name'] = "";
$_POST['artist'] = "";
$_POST['title'] = "";
$_POST['messege'] = "";
header("Location: thanks.htm");
}
}
print <<<EOF
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>NamistaiFM</title>
<link rel="stylesheet" href="blue.css">
<style type="text/css">
<!--
.style1 {color: #000000}
-->
</style>
</head>
<form name="subscribe" action="request.php" method="post">
<body background="images/notes.gif">
<p align="center"><img src = "images/jockeys.gif" width="140" height="107"></p>
<div align="center"><font size="2" face="tahoma">{$done}</font>
<table width="270" height="79" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="273" height="125" border="0" cellpadding="0" cellspacing="1">
<tr>
<td width="123" height="22"><strong><font size="2" face="Tahoma">Name:</font></strong></td>
<td width="147"><input name="name" type="text" id="name" value="{$POST['name']}"></td>
</tr>
<tr>
<td height="22"><strong><font size="2" face="Tahoma">Song
Artist:</font></strong></td>
<td><input name="artist" type="text" id="artist" value="{$POST['artist']}"></td>
</tr>
<tr>
<td height="22"><strong><font size="2" face="Tahoma">Song
Title:</font></strong></td>
<td><input name="title" type="text" id="title" maxlength="210" value="{$POST['title']}"></td>
</tr>
<tr>
<td height="54"><strong><font size="2" face="Tahoma">Message:</font></strong></td>
<td><textarea name="messege" cols="16" rows="5" id="messege">{$POST['message']}</textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<input type="hidden" name="ip" valume="ip">
<input type="submit" name="submit" value="Send It!" />
<br><br>
<font face="tahoma" size ="1" color ="#FF0000"><strong>YOUR I.P : </strong></font><font face="tahoma" size ="1"><strong><span class="style1">$ip</span></strong></font><font face="tahoma" size ="1" color ="#FF0000"><strong> Will
be sent with your request<br></br>
PLEASE READ BEFORE SUBMITTING YOUR REQUEST:</strong></font><br>
<font size="1" face="Tahoma">Sending in the same request more than once will guarantee that your request will NOT be played on the air. Please do not flood our request system. Also, note that your IP is recorded every time you send in a request. Flooding, swearing, and/or abusing the request system could result in an IP ban. Please be respectful.</font>
</center>
</div>
</body>
</form>
</html>
EOF;
?>
I have a field in the mysql table called rq_id, that is autoincriminent, and is the first field in the table.
The system works fine, until I had the rq_report field, then it fails to post the data to the database.
I have no idea why this happens, bassically I wanted the rq_report field so that I could set the standard value of it as 1, then when someone reports a post to an administrator, the value of the rq_report changes to 2, then I wanted code on my page that displays the data from the database to beable to read the rq_report value for each post, if It was 1, do nothing and if it was 2, flag the messege table in red.
First things first though!