: : :
: : : First of all you need to ECHO this statement:
: : :
: : : <form method="POST" action = <?$_SERVER['PHP_SELF']?>>
: : :
: : : so it should be:
: : :
: : : <form method="POST" action = <? echo $_SERVER['PHP_SELF'] ?>>
: : :
: : :
: : : As per ur question try this:
: : :
: : :
: : : :
: : : : <?
: : : : if (isset($_POST['sendit'])) {
: : : : echo "Your Name Is :- ".$_POST['tname'];
: : : : }
: : :
: : : else{
: : : echo <<eof
: : : <form method="POST" action=$_SERVER['PHP_SELF']>
: : : Enter Name :
: : : <input type="text" name="tname">
: : : Enter Age :-
: : : <input type="text" name="age">
: : : <input type="submit" name ="sendit" value="ok">
: : : </form>
: : : eof;
: : : }
: : :
: : : : ?>
: : :
: : :
: : :
: : : Also a note.. you can refer to $_POST['tname'] as $tname (most likely)
: : : You only need to use $_POST if you want to varify that the data was sent via POST.. otherwise you should use $tname instead.
: : :
Snoochie Boochies
: : :
: : :
: : Hi, Thanks alot for you response.You are so nice.
: : I tried your prefered code.It's giving error at the line "echo <<eof" like expecting "," or ";".I used the echo statement as you told (in both the form action statement) but still its not working.I tried my best to fix the error but didn't succeed.
: : May be i am doing something wrong that i couldn't understand.I'll appreciate if you find out the errors.:)
: :
: :
:
:
: OOPS.. you need THREE < symbols.. so it should be:
:
: echo <<<eof
:
: eof;
:
:
Snoochie Boochies
Still not working...i did it so many times .

here is mycode you can see what wrong i am doing if thereis any.
I used EOD also but no effect always sends the following error message ..
Parse error: parse error, unexpected T_SL, expecting ',' or ';' in d:\program files\apache group\apache\htdocs\test\printname.php on line 14
my code is....
<form method="POST" action = <? echo $_SERVER['PHP_SELF']?>>
Enter Your Name :
<input type="text" name="tname"> Enter Age :-
<input type="text" name="age">
<input type="submit" name ="sendit" value="ok">
</form>
<?
if (isset($_POST['sendit'])) {
if (!empty($_POST['tname']) and !empty($_POST['age'])){
echo "Your Name Is :- ".$_POST['tname'];
echo "Your age is :- ". $_POST['age'];
}
else{
echo<<<eof ?>
<form method="POST" action=<? echo $_SERVER['PHP_SELF']?>>
<? echo "Enter Name : ";?>
<input type="text" name="tname">
<? echo "Enter Age :- "; ?>
<input type="text" name="age">
<input type="submit" name ="sendit" value="ok">
</form>
<? eof;
}
?>
I tried ISSET() and EMPTY() functions , those are working fine.But this code is not working.. and i have no clue ... why?