Don Diego Posted April 7, 2007 Share Posted April 7, 2007 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 More sharing options...
neel_basu Posted April 7, 2007 Share Posted April 7, 2007 (int)$_GET['subid'] Is not required Only $_GET['subid'] is enough if the value is integer. Link to comment https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/#findComment-223474 Share on other sites More sharing options...
Don Diego Posted April 7, 2007 Author Share Posted April 7, 2007 Yes, it's true that int() is not necessary. That's why code with and without int() was listed showing that souce= does not take on the value of subiid with or without int(). The problem is that source= does not take on any value. Link to comment https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/#findComment-223636 Share on other sites More sharing options...
neel_basu Posted April 8, 2007 Share Posted April 8, 2007 I dont think It would work But Try this <?php header ("location:http://xyzwebsite.htm?login=apin&source=".htmlentities($_GET['subid']); ?> Link to comment https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/#findComment-223943 Share on other sites More sharing options...
neel_basu Posted April 8, 2007 Share Posted April 8, 2007 But this one is correct <?php header ("location: http://xyzwebsite.htm?login=apin&source=".$_GET['subid']); ?> and must work. For testing purpouse Use this <?php echo "location: http://xyzwebsite.htm?login=apin&source=".$_GET['subid']; ?> Link to comment https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/#findComment-223949 Share on other sites More sharing options...
Don Diego Posted April 8, 2007 Author Share Posted April 8, 2007 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? Link to comment https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/#findComment-223998 Share on other sites More sharing options...
neel_basu Posted April 8, 2007 Share Posted April 8, 2007 Are you using http://abcwebsite/separate.php?subid=123456 Link to comment https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/#findComment-224049 Share on other sites More sharing options...
Don Diego Posted April 8, 2007 Author Share Posted April 8, 2007 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= Link to comment https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/#findComment-224506 Share on other sites More sharing options...
Don Diego Posted April 9, 2007 Author Share Posted April 9, 2007 I had " in the wrong place. Now it's in the right place: <a_ href="http://abcwebsite/separate.php?subid=<?php echo ($_GET['subid']); ?>">info</a_> Now it all works. Solved. Link to comment https://forums.phpfreaks.com/topic/45986-solved-transfer-from-url-to-url/#findComment-224621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.