after i process a query on a page i redirect back to the originating page, where i place the all important file_id place on the tail end of the url
now, when i arrive back at the originating page instead of 'test.com/page.php' like it was when i first landed on it, now it says:
test.com/page.php?file_id=120
what i want to do is somehow grab that '120' and post it, ie:
$fid = [everything on the right of the = of the url];
tia
add a variable from a url into code for posting purposes
Moderator: General Moderators
Re: add a variable from a url into code for posting purposes
Code: Select all
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$test = explode("=",curPageURL());
$t1 = $test[1];
$term2 = $_POST['term2'];
//$term = $_POST['term'];
if ($term2 !="") {
$term2 = $_POST['term2'];
} else {
$term2 = $t1;
}
Re: add a variable from a url into code for posting purposes
Seriously?
Code: Select all
$t1 = $_GET["file_id"];Re: add a variable from a url into code for posting purposes
well, at least it was a nice little seminar on curl
Re: add a variable from a url into code for posting purposes
No, that has nothing to do with curl. It's just basic PHP.inosent1 wrote:well, at least it was a nice little seminar on curl
http://www.w3schools.com/php/php_get.asp