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>
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> <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 " ";
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>