Ik heb de volgende code:
Code: Select all
<html>
<head>
<script language="JavaScript">
function stringPlus(string) {
var result = "";
var c;
for (var j=0; j < string.length; j++) {
if ((c = string.charAt(j)) == "+")
result += "%2b";
else
result += c;
}
return result;
}
function doPost() {
parent.reload.window.location=
"reload.php?"
+ "nick="
+ stringPlus(escape(document.textform.nick.value))
+ "&post="
+ stringPlus(escape(document.textform.text.value));
document.textform.text.value="";
return false;
}
</script>
</head>
<body topmargin="0" marginheight="0" marginwidth="0" leftmargin="0" bgcolor="#EEEEEE">
<form onsubmit="return doPost();" name="textform">
<input type="hidden" name="nick" value="<? echo $_SESSION['un']; ?>"/>
Bericht: <input type="text" size="70" name="text" value=""/>
<input type="submit" value="Verzend"/>
</form>
</body>
</html>
Code: Select all
<?
require "../lib/auth.php";
require "../lib/inc.php";
mysql_query("INSERT INTO forum_chatbox (nickname, message) VALUES ('$nick', '$post')", $db);
?>

edit: $db wordt gemaakt in ../lib/inc.php