Jump to content

Need help with this


tartou2

Recommended Posts

Hello mates

This is supposed to be a page where users can post there message to the chat table but for some reason i can't make the message inside the textarea to be stored in the database.

ANyone can help me to fix the code please

 

<?php

include "../includes/common.php";

$user_id=$HTTP_SESSION_VARS['id'];

$chat=$_POST['chat'];
if($chat==1) {
$message=$_POST['message'];
mysql_query("INSERT INTO chat (user_id,message) VALUES('".$user_id."','".$message."')") or die(mysql_error());

}
require 'header.php';
?>
<br />
<form action="chat.php" method="POST" onSubmit="this.chat.value=1;"> 
<table border="0" cellspacing="2" cellpadding="1" class="tablefadebg" align="center">
<tr valign="top">
<td>Type Here Your Message You want to Post</td><td><textarea cols="60" rows="7" name="message"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit"  name="B2" value="  Post  " style="border: solid 1px #ffbf00; color:yellow;"></td>
<input type="hidden" name="chat">
</tr>
</table>
</form>

Link to comment
https://forums.phpfreaks.com/topic/219354-need-help-with-this/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.