Jump to content

[SOLVED] transfer from url to url


Don Diego

Recommended Posts

I an trying to get $_GET['subid'] to transfer a variable six digit integer from one url to another. 

 

The process is like this:

 

A link on a site not mine is clicked opening my page whose url looks like this:

 

http://abcwebsite.php?subid=xxxxxx

 

where xxxxxx represents a variable integer of 6 varying digits with no spaces or other characters,  but I don't control what the digits are.

 

Then a link on my page is clicked and another website page not mine opens looking like this:

 

http://xyzwebsite.htm?source=

 

Source= needs to take on the value of subid.

 

When I try this:

 

<?php header ("location:http://xyzwebsite.htm?login=apin&source=".(int)$_GET['subid']); 
?>

 

the url shows source=0.

 

When I try this:

 

<?php header ("location:http://xyzwebsite.htm?login=apin&source=".(htmlentities)$_GET['subid']); ?>

 

the page will not open.

 

When I try this:

 

<?php header ("location:http://xyzwebsite.htm?login=apin&source=".$_GET['subid']); ?>

 

the url shows no value for source=.

 

When I try this:

 

<?php print '<meta http-equiv="refresh" content="0;URL=http://xyzwebsite.htm?login=apin&source=?'.(int)$_GET['subid'].'">'; ?>

 

the url shows source=%3F0

 

On the same page, the following is working fine to capture the value of subid for inclusion in an email:

 

<input type="hidden" name="subid" value="<?php echo htmlentities($_GET['subid']); ?>" /> 

 

I just can't get anything to work for url to url.

Link to comment
https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/
Share on other sites

The code is in a separate file, http://abcwebsite/separate.php.

 

When the file has this:

 

<?php header ("location:http://xyzwebsite.htm?source=123456"); ?>

 

then this results:

 

http://xyzwebsite.htm?source=123456

 

When I have this in the separate file:

 

<?php header ("location:http://xyzwebsite.htm?login=apin&source=".$_GET['subid']); ?>

 

then this results:

 

http://xyzwebsite.htm?source=

 

There is nothing in the separate file except:

 

<?php header ("location:http://xyzwebsite.htm?login=apin&source=".$_GET['subid']); ?>

 

So source= gets a value in the literal case but not when using $_GET['subid'].

 

The following link is in the page, http://abcwebsite.php:

 

<a href="http://abcwebsite/separate.php">info</a>

 

So when the link is clicked, the value of subid in the query string of http://abcwebsite.php should be passed to the query string of http://xyzwebsite.htm, but it is not.

 

There is no other code in the page except in a form which emails me the entries and the value of subid:

 

<form method="post" action="<?php echo 'http://abcwebsite/landing_email.php?'.$_SERVER['QUERY_STRING']; ?>"

<input type="hidden" name="subid" value="<?php echo ($_GET['subid']); ?>" />

 

So $_GET['subid'] picks up the value for emails, but not for passing from query string to query string.

 

What else is needed for query string to query string?

 

 

 

 

I am not using http://abcwebsite/separate.php?subid=123456. The value is variable.  I was just seeing what would happen as part of figuring this out.

 

I now realize what the problem is, and can pose a better question.

 

What is the method/function to send a varying particular query string value, subid=, from

 

http://abcwebsite.php?subid=xxxxxx to http://abcwebsite/separate.php

 

when the link, <a_ href="http://abcwebsite/separate.php">info</a_> is clicked?

 

This code which is in the separate.php file:

 

<?php header ("location:http://xyzwebsite.htm?login=apin&source=".$_GET['subid']); ?>

 

may then be enabled to send the value into the query string of:

 

http://xyzwebsite.htm?source=

 

If I make the link like this:

 

<a_ href="http://abcwebsite/separate.php?"subid=<?php echo ($_GET['subid']); ?>>info</a_>

 

the value shows in the link (view source), but it has to be sent to http://abcwebsite/separate.php before it can end up in the query string of http://xyzwebsite.htm?source=

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.