i have a application where i have a text box when the user enters data in the text box i want the data to be inserted in the db and the value displayed in the same page.something like daniweb post quick reply.i know i have to use ajax but i did not acorrect code.please send some samole code .i am new to ajax

why do you need to use ajax ?
you can do a simple postback which is alot easier.

if ajax is amust you must have some knowledge of javascript aswell.

can you be little brief......

??? sorry i dont quite understand what your asking ??

u said post back...do u mean PHP_SELF

if(isset($_POST["yourname"])) {
  // Process database save

        <form action="<? echo $_SERVER['php_self']; ?>" method="post">
            <input type="text" name="yourname" />
            <input type="submit" value="enter data" />

my website link is
but when i use PHP_SELF ,the url changes to http://www.website.com/testing/detailforum.php
so i am getting the output


$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");

$result=mysql_query("SELECT * FROM startp where postid='$line'");
for ($i = 0; $i < 1; ++$i)
$line = mysql_fetch_row($result);

echo "<table width='85%'  bgcolor='#D7D7D7'>";
print "<tr><td align='center'><font face='Times New Roman'  size='5'><strong> $line[1] </strong></font></td></tr>";
print "</table>";
print "<table width='85%'   bgcolor='#EBEBEB'>";
print "<tr><td></td></tr>";
print "<tr><td><font face='Times New Roman'  size='3'><strong><i>   Description</i></strong></font></td></tr>";
print "<tr><td width='1%'></td><td>$line[2]</td></tr>";
echo "</table>";


$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
if(isset($_POST["submit"])) {

$todays = date('Y-m-d h-i-s');
mysql_query("insert into replying(replytext,replyuser,postiid,replydate) values('$message','$uname','$linn','$todays')") or die ("ERROR:".mysql_error());
$result=mysql_query("select * from replying where postiid='$line' order by replydate DESC") or die ("ERROR:".mysql_error());

echo $row[0];
echo $row[1];
 <form method="post" name="form2" action="<? echo $_SERVER['PHP_SELF']; ?>"
<input type="text" name="message">
<input type="text" name="uname">
<input type="submit" name="submit" value="submit">


thats correct you need to get the whole querystring aswell if you want to retain the querystring variable. E.G.

action="<? echo $_SERVER["REQUEST_URI"]; ?>"

thanks a lot!!!!!!!!!!!