Code: Select all
<html><title>test</title>
<script type="text/javascript">
<!--
function addsmiley(code)
{
var pretext = document.news.message.value;
this.code = code;
document.news.message.value = pretext + code;
}
//-->
</script>
<body>
<form name=news method=post action=add.php>
<table width="28%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="28%">Name :</td>
<td width="72%"><input name="name" type="text" id="name"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<img src="angry_smile.gif" alt="Angry" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':@')">
<img src="confused_smile.gif" alt="Confused" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':s')">
<img src="cry_smile.gif" alt="Crying" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':'(')">
<img src="dissapointed_smile.gif" alt="Dissapointed" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':|')">
<img src="embrassed_smile.gif" alt="Embrassed" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':$')">
<img src="heart.gif" alt="Heart" width="19" height="19" style="cursor: pointer;" onClick="addsmiley('l')">
<img src="open_mouth_smile.gif" alt="Open Mouth Smile" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':d')">
<br>
<img src="present.gif" alt="Gift" width="19" height="19" style="cursor: pointer;" onClick="addsmiley('g')">
<img src="rose.gif" alt="Red Rose" width="19" height="19" style="cursor: pointer;" onClick="addsmiley('f')">
<img src="sad_smile.gif" alt="Sad" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':(')">
<img src="smile.gif" alt="Smile" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':)')">
<img src="surprise.gif" alt="Surprise" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':o')">
<img src="tongue_out_smile.gif" alt="Tongue Out" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(':p')">
<img src="wink_smile.gif" alt="Wink" width="19" height="19" style="cursor: pointer;" onClick="addsmiley(';)')">
</td>
</tr>
<tr>
<td>Message :</td>
<td><textarea name="message" rows="5" id="message"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</html>Code: Select all
<?php
$user="root";
$pwd="password";
$db="db";
$host="localhost";
$conn=mysql_connect("$host","$user","$pwd")
or die("Couldn't connect to MYSQL.");
$name=$_POSTї'name'];
$message=$_POSTї'message'];
mysql_select_db($db);
if (!$conn){print "error: " . mysql_error() . "\n";}
$sql = "INSERT INTO msg (name,message) VALUES ('$name', '$message')";
$result = mysql_query($sql, $conn);
if (mysql_error()) { print "Database ERROR: $sql " . mysql_error(); }
?>i don't know the code.... can anybody help me...????
feyd | use
Code: Select all
tags whileCode: Select all
tags are down![/color]