Jump to content


Photo

The passing of post variables, sometimes not working as expected


  • Please log in to reply
1 reply to this topic

#1 anner

anner
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 03 August 2006 - 12:15 PM

I'm trying to convert my old perl frames site into my new PHP CMS.  All in all, it's working quite well.  I don't have time to recode it all right now, so I'm using include to run my perl functions.  Most of the time this is working fine.  My code looks like this:

<?php
global $user;
$function = 'http://my.admin.site/AdminFunctions/adminmodify.cgi?User=';
$send = $function . $user->name;
if ($_POST['Search'])
{$Search = $_POST['Search'];
$send = $send . "&Search=" . urlencode($Search);
}
elseif ($_POST['Show'])
{$Show = $_POST['Show'];
$send = $send . "&Show=" . urlencode($Show);
}
elseif ($_POST['Modify'])
{$Modify = $_POST['Modify'];
$send = $send . "&Modify=" . urlencode($Modify);
}
elseif ($_POST['Delete'])
{$Delete = $_POST['Delete'];
$send = $send . "&Delete=" . urlencode($Delete);
}
else
{$Main = "Main";
$send = $send . "&Main=" . urlencode($Main);
}
if ($_POST['AdminID'])
{$AdminID = $_POST['AdminID'];
$send = $send . "&AdminID=" . urlencode($AdminID);
}
if ($_POST['Password'])
{$Password = $_POST['Password'];
$send = $send . "&Password=" . urlencode($Password);
}
if ($_POST['Admin'])
{$Admin = $_POST['Admin'];
$send = $send . "&Admin=" . urlencode($Admin);
}
if ($_POST['Email'])
{$Email = $_POST['Email'];
$send = $send . "&Email=" . urlencode($Email);
}
if ($_POST['Phone'])
{$Phone = $_POST['Phone'];
$send = $send . "&Phone=" . urlencode($Phone);
}
if ($_POST['Domain'])
{$Domain = $_POST['Domain'];
$send = $send . "&Domain=" . urlencode($Domain);
}
if ($_POST['Domains'])
{$Domains = $_POST['Domains'];
$send = $send . "&Domains=" . urlencode($Domains);
}
if ($_POST['Rights'])
{$Rights = $_POST['Rights'];
$send = $send . "&Rights=" . urlencode($Rights);
}
if ($_POST['Datafile'])
{$Datafile = $_POST['Datafile'];
$send = $send . "&Datafile=" . urlencode($Datafile);
}

echo $send;
include $send;

?>

I grab any posted variables, then pass them in the URL to the perl function.  It works fine for the Main, Search, and Show pages; for those pages the URL in my address bar is my php page and the URL created in $send contains all the correct variables.  My problem is with the Modify and Delete.  When either of these are posted, the URL in my address bar contains all the variables, and the URL created in $send has none, which causes me to return to my main page and doesn't accomplish the Modify or Delete.

I have looked and looked at the forms that do the posting, but cannot see any difference.  What would cause something like this?

Any help will be greatly appreciated.  I feel I'm really beating my head against a wall on this one.

#2 anner

anner
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 03 August 2006 - 12:46 PM

In case anyone is curious, I had a stray '
<form action=http://my.admin.stie/adminmodify.cgi method=POST'>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users