Jump to content

The passing of post variables, sometimes not working as expected


anner

Recommended Posts

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:

[code]<?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;

?>[/code]

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.