Page 1 of 1

No Get or POST data after submitting form

Posted: Thu Feb 05, 2009 5:48 pm
by neal.pressley
Hello, I have a funny problem. I have a long php file in which I have added a HTML form which is very simple. It has a checkbox and then submit button. I submit the form to the self (same php file) and then check if the checkbox was clicked. When checkbox was not clicked, $_POST gives me the data that submit was hit but when checkbox was clicked, I do not get any POST data. The problem is not consistent. Some times it works but mostly it does not work. I change from POST to GET and the same problem.
To isolate the problem, I just copied the poriton of the form which was creating the problem in a new file test1.php and it works perfectly. Again, now if I submit the form from my origional file "ManageMapping.php" to this test1.php, I see that POST has all the data. However, when I go back to my origional file "ManageMapping.php". it does not work. The test1.phpo which works is below

Code: Select all

 
<?php
    echo "<pre>";
    echo "post is";
    print_r($_POST);
    echo "get is";
    print_r($_GET);
            echo "request is";
    print_r($_REQUEST);
    echo "let us check HTTP_POST_VARS";
    print_r($HTTP_POST_VARS);
    echo "</pre>";
 
 
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" media="all" href="../../stylesheet.css">
<title>Managing URL to StartContext Mapping </title>
</head>
 
<body style="margin: 0px;" onLoad="preloader();">
 
 
<form enctype="multipart/form-data" action="test1.php" method="POST">
<input type="hidden" name="submitted" value="true">
 
<input type="checkbox" name="dboptions" class="radio">Delete existing mappings from the database before loading the data from the CSV File.
<input type="submit" name="submit" class="buttons" value="submit">
</form> 
 
 
</body>
</html>
 
The origional file "ManageMapping.php" which is creating problem is huge but reproduced here for reference.

Code: Select all

 
<?php
    echo "<pre>";
    print_r($_POST);
    echo "get is";
        print_r($_GET);
            echo "request is";
        print_r($_REQUEST);
    echo "let us check HTTP_POST_VARS";
    print_r($HTTP_POST_VARS);
    echo "</pre>";
 
session_start();
require('../../inc/inputcheck.php');
set_time_limit(0);
 
 
// Make sure user is logged in.
if ($_SESSION['BOTID']==""){
    header('Location: http://'.$_SERVER['HTTP_HOST'].root_dir().'/index.php?kOut=true');
}
if ($_SESSION['display_mode']!=""){
    $display_mode=$_SESSION['display_mode'];
        }
    else
    {
        $display_mode="new";
    }
 
 
 
if ($_POST['submitted']){
    echo "page submitted";
            $display_mode="submitted";
            }
 
echo "display_mode is".$display_mode;
 
$dbupdated="false";
 
if ($_SESSION['mapping_array']!=""){
    $mapping_array=$_SESSION['mapping_array'];
}
 
 
 
 
if ($display_mode=="submitted"){
    echo "Display mod is submitted. Let us update database";
    $dbconnect=oci_connect($_SESSION['db_username'],$_SESSION['db_password'],$_SESSION['sid']) or die(oci_error());
    if($_POST['dboptions']=="on")
    {
        $query = "delete from vzn_startcontext";
        $stmt = oci_parse($dbconnect, $query);
        if (!$stmt) {
             $e = oci_error($dbconnect);
            print htmlentities("Somethings wrong : " .$e['message']);
            exit;
            }
        $r = oci_execute($stmt,OCI_DEFAULT);    
        if (!$r) {
            $e = oci_error($stmt);
            echo "<pre>".$e['message']."</pre>\n";
            }
    }
            
    foreach($mapping_array as $mapping_array_row){
        $query = "insert into vzn_startcontext values("."'".$mapping_array_row['url']."','".$mapping_array_row['pagetitle']."',".strlen($mapping_array_row['url']).",'".$mapping_array_row['startcontext']."')";
        $stmt = oci_parse($dbconnect, $query);
        if (!$stmt) {
             $e = oci_error($dbconnect);
             echo "<pre>".$e['message']."</pre>\n";
             exit;
            }
        $r = oci_execute($stmt, OCI_DEFAULT);   
        if (!$r) {
            $e = oci_error($stmt); 
            echo "<pre>".$e['message']."</pre>\n";
                }
        }
 
oci_commit($dbconnect);
$dbupdated=true;
$_SESSION['dbupdated']= $dbupdated;
echo "updating the database was successfull, changing the display mode to dbupdated";
$display_mode="dbupdated";
header('Location: http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/ManageMapping.php');
}
 
 
 
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" media="all" href="../../stylesheet.css">
<script language="JavaScript" src="../../javascript/CalendarPopup.js"></script>
<script language="JavaScript" src="../../javascript/AnchorPosition.js"></script>
<script language="JavaScript" src="../../javascript/date.js"></script>
<script language="JavaScript" src="../../javascript/PopupWindow.js"></script>
<script language="javascript">
<!--
    
    function preloader(){
        AllImages=new Array("../../site_images/Category_on.gif", "../../site_images/Conv2_on.gif", "../../site_images/Usage_on.gif", "../../site_images/Answer_on.gif", "../../site_images/Word_on.gif", "../../site_images/Download_on.gif", "../../site_images/YHome_on.gif");
        for(loadall=0; loadall<AllImages.length; loadall++){
            var LoadedImage=new Image();
            LoadedImage.src=AllImages[loadall];
        }
    }
    
        function overImage(imageItem){
        image = eval(document.getElementById(imageItem));
        image.src = "../../site_images/"+imageItem+"_on.gif";
    }
    
    function outImage(imageItem){
        image = eval(document.getElementById(imageItem));
        image.src = "../../site_images/"+imageItem+"_off.gif";
    }
//-->
</script>
<title>Managing URL to StartContext Mapping </title>
</head>
 
<body style="margin: 0px;" onLoad="preloader();">
<table width="770" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="117" valign="top">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td><img src="../../images/space.gif" width="1" height="50"></td>
                </tr>
                <tr>
                    <td>&nbsp;<span class="left_title">Managing URL to StartContext Mapping </span></td>
                </tr>
                <tr>
                    <td><img src="../images/space.gif" width="1" height="5"></td>
                </tr>
                <tr>
                    <td><a href="category.php"><img src="../../site_images/Category_on.gif" border="0" id="Category"></a></td>
                </tr>
                <tr>
                    <td><a href="conversations.php" onMouseOver="overImage('Conv2');" onMouseOut="outImage('Conv2');"><img src="../../site_images/Conv2_off.gif" border="0" id="Conv2"></a></td>
                </tr>
                <tr>
                    <td><a href="usage.php" onMouseOver="overImage('Usage');" onMouseOut="outImage('Usage');"><img src="../../site_images/Usage_off.gif" border="0" id="Usage"></a></td>
                </tr>
                <tr>
                    <td><a href="answerFreq.php?botid=<?php echo $BOTID; ?>" onMouseOver="overImage('Answer');" onMouseOut="outImage('Answer');"><img src="../../site_images/Answer_off.gif" border="0" id="Answer"></a></td>
                </tr>
                <tr>
                    <td><a href="wordSearch.php" onMouseOver="overImage('Word');" onMouseOut="outImage('Word');"><img src="../../site_images/Word_off.gif" border="0" id="Word"></a></td>
                </tr>
                <tr>
                    <td><a href="download/index.php" onMouseOver="overImage('Download');" onMouseOut="outImage('Download');"><img src="../../site_images/Download_off.gif" border="0" id="Download"></a></td>
                </tr>
                <tr>
                    <td><a href="../../sign-in.php" onMouseOver="overImage('YHome');" onMouseOut="outImage('YHome');"><img src="../../site_images/YHome_off.gif" border="0" id="YHome"></a></td>
                </tr>
            </table>
        </td>
        <td width="653" align="center">
            
            <table> <!-- start table to represent right column -->
 
<!-- start of first inner table -->
 
            <tr>    <td align="left">
            <table><tr> <td align="left">
        <br>
        <br>
<?php
echo "display mod is".$display_mode;
if (($display_mode=="new")||($display_mode=="readfile")){
?>
 
<FORM ENCTYPE="multipart/form-data" ACTION="readmappingfile.php" METHOD=POST>
<strong>URL to StartContext Mapping File : </strong><br>
The file must be in CSV format with the structure : - URL, Title, StartContext. The header row must not be present.<br>
<INPUT NAME="mapping_file" size="75" TYPE="file">
<INPUT TYPE="submit" VALUE="Read File"><br>
</FORM>
</td></tr>
</table>
</td></tr>
<!-- end  of first inner table -->
 
<?php
}
?>
 
 
<?php
if ($display_mode=="readfile"){
?>
<!-- start of second inner table -->
<tr>    <td align="left">
<table width="250" border="1" cellspacing="0" cellpadding="1" bordercolor="gray" align="left" >
    <tr><td>URL</td><td>Title</td><td>StartContext</td></tr>
 
<?php
foreach($mapping_array as $mapping_array_row)
    {
    echo "<tr>";
    foreach($mapping_array_row as $mapping_array_row_cell){
        echo "<td align=\"left\">";
        if ($mapping_array_row_cell!='')
        echo $mapping_array_row_cell;
        else
            echo "&nbsp";
        echo "</td>";
        }
    echo "</tr>";
    }
?>
</table>
</td></tr>
<!-- end of second inner table -->
 
<!-- start of third  inner table -->
<tr><td>
<table border="0" cellpadding="4" cellspacing="2" >
<tr><td>
 
<form enctype="multipart/form-data" action="ManageMapping.php" method="post">
<input type="hidden" name="submitted" value="true">
 
<table>
<!--    <tr>
        <td align="right"><input type="radio" name="dboptions" class="radio" value="replace1"></td>
        <td>Replace existing mappings in the database with the data from the CSV File.</td>
    </tr>
    <tr>
        <td align="right"><input type="radio" name="dboptions" class="radio" value="append"></td>
        <td>Append existing mappings in the database with the data from CSV File.</td>
 
    <tr> -->
 
    <tr>
        <td align="right"><input type="checkbox" name="dboptions" class="radio"></td>
        <td>Delete existing mappings from the database before loading the data from the CSV File.</td>
 
    <tr>
 
        <td colspan="2" align="right">      
        <br></td>
    </tr>
</table>
<input type="submit" name="submit" class="buttons" value="submit">
    </form>
 
</td></tr></table>
</td></tr>
<!-- end of third  inner table -->
 
 
<?php
}else if ($display_mode=="dbupdated"){
    if ($_SESSION['dbupdated'])
        {
            echo "The mapping into database has been successfully updated.";
        }
    }
?>
 
 
 
 
            </table> <!-- end table to represent right column -->
 
</td></tr></table>
 
 
<form enctype="multipart/form-data" action="ManageMapping.php" method="post">
<input type="hidden" name="submitted" value="true">
 
<input type="checkbox" name="dboptions" class="radio">Delete existing mappings from the database before loading the data from the CSV File.
<input type="submit" name="submit" class="buttons" value="submit">
</form> 
 
 
 
 
</body>
</html>
 
 
 

Re: No Get or POST data after submitting form

Posted: Thu Feb 05, 2009 6:13 pm
by jayshields
Why are you using the enctype attribute in your form tag? Try it without that.

Re: No Get or POST data after submitting form

Posted: Thu Feb 05, 2009 6:21 pm
by neal.pressley
I tested without enctype. I replaced the origional line with <form action="ManageMapping.php" method="post">
But it does not resolve the problem. Status is same. test1.php works . ManageMapping.php is able to get the post data only if I do not select the checkbox and only hit the submit button. If I select the checkbox and hit the submit button, there is no POST data. Please advise as this is the second continuous day of troubleshooting of this silly problem.

Re: No Get or POST data after submitting form

Posted: Thu Feb 05, 2009 6:50 pm
by nor0101
You might try adding a value attribute to the checkbox input element.

Re: No Get or POST data after submitting form to PHP

Posted: Thu Feb 05, 2009 7:24 pm
by neal.pressley
I tried now by adding value attribute for checkbox. Surprisingly it worked once immidiately after the change and then it never worked. I thought issue with cashe etc and I restarted the server but the problem is still there.
Behavior is consistent. If I only hit submit, I get correct response as below:

Code: Select all

POST isArray
(
    [submitted] => true
    [submit] => submit
)
get isArray
(
)
request isArray
(
    [submitted] => true
    [submit] => submit
    [PHPSESSID] => a10vud149jt2dcgprrndei9fs4
)
HTTP_POST_VARS  is
but if I check the checkbox and hit submit, I get this

Code: Select all

POST isArray
(
)
get isArray
(
)
request isArray
(
    [PHPSESSID] => a10vud149jt2dcgprrndei9fs4
)
HTTP_POST_VARS  is
display_mode isreadfile
The modified code for quick reference is

Code: Select all

<?php
session_start();
require('../../inc/inputcheck.php');
set_time_limit(0);
 
// for debugging only
echo "<pre>";
echo "POST is";
print_r($_POST);
echo "get is";
print_r($_GET);
echo "request is";
print_r($_REQUEST);
echo "HTTP_POST_VARS  is";
print_r($HTTP_POST_VARS);
echo "</pre>";
 
 
// Make sure user is logged in.
if ($_SESSION['BOTID']==""){
    header('Location: http://'.$_SERVER['HTTP_HOST'].root_dir().'/index.php?kOut=true');
}
 
if ($_SESSION['display_mode']!="")
    {
        $display_mode=$_SESSION['display_mode'];
    }
    else
    {
        $display_mode="new";
    }
 
 
if ($_POST['submitted'])
    {
            $display_mode="submitted";
    }
 
echo "display_mode is".$display_mode;
 
$dbupdated="false";
 
if ($_SESSION['mapping_array']!="")
    {
        $mapping_array=$_SESSION['mapping_array'];
    }
 
 
 
 
if ($display_mode=="submitted"){
    echo "Display mod is submitted. Let us update database";
    $dbconnect=oci_connect($_SESSION['db_username'],$_SESSION['db_password'],$_SESSION['sid']) or die(oci_error());
    if($_POST['dboptions']=="delete")
    {
        $query = "delete from vzn_startcontext";
        $stmt = oci_parse($dbconnect, $query);
        if (!$stmt) {
             $e = oci_error($dbconnect);
            print htmlentities("Somethings wrong : " .$e['message']);
            exit;
            }
        $r = oci_execute($stmt,OCI_DEFAULT);    
        if (!$r) {
            $e = oci_error($stmt);
            echo "<pre>".$e['message']."</pre>\n";
            }
    }
            
    foreach($mapping_array as $mapping_array_row){
        $query = "insert into vzn_startcontext values("."'".$mapping_array_row['url']."','".$mapping_array_row['pagetitle']."',".strlen($mapping_array_row['url']).",'".$mapping_array_row['startcontext']."')";
        $stmt = oci_parse($dbconnect, $query);
        if (!$stmt) {
             $e = oci_error($dbconnect);
             echo "<pre>".$e['message']."</pre>\n";
             exit;
            }
        $r = oci_execute($stmt, OCI_DEFAULT);   
        if (!$r) {
            $e = oci_error($stmt); 
            echo "<pre>".$e['message']."</pre>\n";
                }
        }
 
oci_commit($dbconnect);
$dbupdated=true;
$_SESSION['dbupdated']= $dbupdated;
echo "updating the database was successfull, changing the display mode to dbupdated";
$display_mode="dbupdated";
header('Location: http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/ManageMapping.php');
}
 
 
 
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" media="all" href="../../stylesheet.css">
<script language="JavaScript" src="../../javascript/CalendarPopup.js"></script>
<script language="JavaScript" src="../../javascript/AnchorPosition.js"></script>
<script language="JavaScript" src="../../javascript/date.js"></script>
<script language="JavaScript" src="../../javascript/PopupWindow.js"></script>
<script language="javascript">
<!--
    
    function preloader(){
        AllImages=new Array("../../site_images/Category_on.gif", "../../site_images/Conv2_on.gif", "../../site_images/Usage_on.gif", "../../site_images/Answer_on.gif", "../../site_images/Word_on.gif", "../../site_images/Download_on.gif", "../../site_images/YHome_on.gif");
        for(loadall=0; loadall<AllImages.length; loadall++){
            var LoadedImage=new Image();
            LoadedImage.src=AllImages[loadall];
        }
    }
    
        function overImage(imageItem){
        image = eval(document.getElementById(imageItem));
        image.src = "../../site_images/"+imageItem+"_on.gif";
    }
    
    function outImage(imageItem){
        image = eval(document.getElementById(imageItem));
        image.src = "../../site_images/"+imageItem+"_off.gif";
    }
//-->
</script>
<title>Managing URL to StartContext Mapping </title>
</head>
 
<body style="margin: 0px;" onLoad="preloader();">
<table width="770" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="117" valign="top">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td><img src="../../images/space.gif" width="1" height="50"></td>
                </tr>
                <tr>
                    <td>&nbsp;<span class="left_title">Managing URL to StartContext Mapping </span></td>
                </tr>
                <tr>
                    <td><img src="../images/space.gif" width="1" height="5"></td>
                </tr>
                <tr>
                    <td><a href="category.php"><img src="../../site_images/Category_on.gif" border="0" id="Category"></a></td>
                </tr>
                <tr>
                    <td><a href="conversations.php" onMouseOver="overImage('Conv2');" onMouseOut="outImage('Conv2');"><img src="../../site_images/Conv2_off.gif" border="0" id="Conv2"></a></td>
                </tr>
                <tr>
                    <td><a href="usage.php" onMouseOver="overImage('Usage');" onMouseOut="outImage('Usage');"><img src="../../site_images/Usage_off.gif" border="0" id="Usage"></a></td>
                </tr>
                <tr>
                    <td><a href="answerFreq.php?botid=<?php echo $BOTID; ?>" onMouseOver="overImage('Answer');" onMouseOut="outImage('Answer');"><img src="../../site_images/Answer_off.gif" border="0" id="Answer"></a></td>
                </tr>
                <tr>
                    <td><a href="wordSearch.php" onMouseOver="overImage('Word');" onMouseOut="outImage('Word');"><img src="../../site_images/Word_off.gif" border="0" id="Word"></a></td>
                </tr>
                <tr>
                    <td><a href="download/index.php" onMouseOver="overImage('Download');" onMouseOut="outImage('Download');"><img src="../../site_images/Download_off.gif" border="0" id="Download"></a></td>
                </tr>
                <tr>
                    <td><a href="../../sign-in.php" onMouseOver="overImage('YHome');" onMouseOut="outImage('YHome');"><img src="../../site_images/YHome_off.gif" border="0" id="YHome"></a></td>
                </tr>
            </table>
        </td>
        <td width="653" align="center">
            
            <table> <!-- start table to represent right column -->
 
<!-- start of first inner table -->
 
            <tr>    <td align="left">
            <table><tr> <td align="left">
        <br>
        <br>
<?php
echo "display mod is".$display_mode;
if (($display_mode=="new")||($display_mode=="readfile")){
?>
 
<FORM name="form1" enctype="multipart/form-data" ACTION="readmappingfile.php" METHOD=POST>
<strong>URL to StartContext Mapping File : </strong><br>
The file must be in CSV format with the structure : - URL, Title, StartContext. The header row must not be present.<br>
<INPUT NAME="mapping_file" size="75" TYPE="file">
<INPUT TYPE="submit" VALUE="Read File"><br>
</FORM>
</td></tr>
</table>
</td></tr>
<!-- end  of first inner table -->
 
<?php
}
?>
 
 
<?php
if ($display_mode=="readfile"){
?>
<!-- start of second inner table -->
<tr>    <td align="left">
<table width="250" border="1" cellspacing="0" cellpadding="1" bordercolor="gray" align="left" >
    <tr><td>URL</td><td>Title</td><td>StartContext</td></tr>
 
<?php
foreach($mapping_array as $mapping_array_row)
    {
    echo "<tr>";
    foreach($mapping_array_row as $mapping_array_row_cell){
        echo "<td align=\"left\">";
        if ($mapping_array_row_cell!='')
        echo $mapping_array_row_cell;
        else
            echo "&nbsp";
        echo "</td>";
        }
    echo "</tr>";
    }
?>
</table>
</td></tr>
<!-- end of second inner table -->
 
<!-- start of third  inner table -->
<tr><td>
<table border="0" cellpadding="4" cellspacing="2" >
<tr><td>
 
<!-- <form action="ManageMapping.php" method="post">
<input type="hidden" name="submitted" value="true">
 
<table>
<!--    <tr>
        <td align="right"><input type="radio" name="dboptions" class="radio" value="replace1"></td>
        <td>Replace existing mappings in the database with the data from the CSV File.</td>
    </tr>
    <tr>
        <td align="right"><input type="radio" name="dboptions" class="radio" value="append"></td>
        <td>Append existing mappings in the database with the data from CSV File.</td>
 
    <tr> -->
 
<!--    <tr>
        <td align="right"><input type="checkbox" name="dboptions" class="radio" value="delete"></td>
        <td>Delete existing mappings from the database before loading the data from the CSV File.</td>
 
    <tr>
 
        <td colspan="2" align="right">      
        <br></td>
    </tr>
</table>
<input type="submit" name="submit" class="buttons" value="submit">
    </form> -->
 
</td></tr></table>
</td></tr>
<!-- end of third  inner table -->
 
 
<?php
}else if ($display_mode=="dbupdated"){
    if ($_SESSION['dbupdated'])
        {
            echo "The mapping into database has been successfully updated.";
        }
    }
?>
 
 
 
 
            </table> <!-- end table to represent right column -->
 
</td></tr></table>
 
 
 
<FORM name="form2"  action="ManageMapping.php" method="post">
<input type="hidden" name="submitted" value="true">
 
<input type="checkbox" name="dboptions" value="delete" class="radio">Delete existing mappings from the database before loading the data from the CSV File.
<input type="submit" name="submit" class="buttons" value="submit">
</form> 
 
 
 
 
</body>
</html>
 

Re: No Get or POST data after submitting form

Posted: Fri Feb 06, 2009 10:46 am
by nor0101
I think you need to confirm that you're executing the correct version of the script. Here's a clue: the string "let us check HTTP_POST_VARS" doesn't appear anywhere in your corrected version, yet it appears in your output.

Re: No Get or POST data after submitting form

Posted: Fri Feb 06, 2009 11:19 am
by neal.pressley
nor0101, in the above post, the code is the recent one.. ( I made some changes based on the feedback).. the output were not the latest but now I have modified so that the acutal output is shown from the code above. Now, what you see in the above post is all latest version and the problem is still there.

Re: No Get or POST data after submitting form

Posted: Fri Feb 06, 2009 11:22 am
by Paul Arnold
Have you got a .htaccess file in your folder?
I had a similar problem the other week and it was a fault in the HTaccess.

Re: No Get or POST data after submitting form

Posted: Fri Feb 06, 2009 12:21 pm
by neal.pressley
I do not have any .htaccess file in the folder where this php script it. I am using IIS.

Re: No Get or POST data after submitting form

Posted: Fri Feb 06, 2009 5:59 pm
by neal.pressley
Thank you , Guys for responding to my query. One solution which works for troublshooting is to take a break. I worked on this problem for continuous two days.. posted at different forums and then finally "almost" gave up. Took a break for couple of hours today and then came back to start looking at the code with a fresh mind. And, within few minutes I realised, when I submit the button, though it get submitted to the php but then due to header redirect code - //header('Location: http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/ManageMapping.php');it was again being submitted to same php and probably that was the reason for missing POST parameters. I commented out the above header redirection and it works prefectly now.
And, Kudos to aschk on phpfreaks form, though you mentioned thatheader redirect might be the problem, I am sorry, I did not pay that much attention that time.