Home  |  About  | Last |  Submit  |  Contact
AllQuests.com




Previous Question:  [all variants] Evolution Message Filter Problem  Absolute Beginner TalkNext Question:  [ubuntu] SDL program messed up my display.  General Help
Question transfer from url to url ( SitePoint Forums PHP )
Updated: 2010-07-21 05:50:04 (7)
transfer from url to url

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

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:

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

When I try this:

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

When I try this:

Code:
<?php header ("location:http://xyzwebsite.htm?login=apin&source=".$_GET['subid']); ?>
the url shows no value for source=.

When I try this:

Code:
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:

Code:
<input type="hidden" name="subid" value="<?php echo htmlentities($_GET['subid']); ?>" />
I just can't get anything to work for url to url.

Answers: transfer from url to url ( SitePoint Forums PHP )
transfer from url to url

Youve said in your post that you want a link to appear on your website, but you only show code for a redirection ??

TO make a link a appear

PHP Code:

echo '<a href="http://www.xyzdomain.com/page.php?source=' . $_GET['subid'] . ' ">Click Here</a>'; 

You need to sanitise $_GET['subid'] before this code, but this gives you the idea

Mandes

transfer from url to url

No, I did not say that I want a link to appear.

What I am saying is this:

A link on page abc is clicked and a new page xyz opens.

I want the value of subid= in the url of abc to appear in the url of xyz as the value of source=.

As stated, source= is not taking on that value, even though $_GET['subid']); in the form on page abc does capture the value of subid= in a hidden field for emailing.

In the form, $_GET['subid']) does what I want. In the transfer to another url, it does not.

That is the problem.

tableman

transfer from url to url

what you are doing should work.

Can you print the value of subid on page abc and see if it has any value?

voodoomagic

transfer from url to url

I can print the url and the value of subid is included as is everything in the url.

It's there in the url as stated in the original post:

http://abcwebsite.php?subid=xxxxxx

It exists and I know it is available because as explained in the original post, $_GET['subid'] is capturing it for inclusion in emails from a form in the same page.

I can see the value of subid in the hidden field in the form when I do view source. It's in the email if an email is sent from the form.

The code "should" work for url to url, but it does not.

Why is $_GET['subid'] working for the hidden field and not working in this code for url to url?

tableman

transfer from url to url

Quote:
Originally Posted by tableman
Why is $_GET['subid'] working for the hidden field and not working in this code for url to url?
You must be doing something wrong. Post all the code you are using on the second page.

PHP Code:

if (isset($_GET['subid'])) {
    
// Do validation here
    
if (true) { // REPLACE WITH VALIDATION!!!
        
header('location: http://xyzwebsite.htm?login=apin&source=' . $_GET['subid']);
        exit;
    }
}
This is working just fine for me.

test.php?subid=500 === xyzwebsite.htm?login=apin&source=500

logic_earth

transfer from url to url

Yes, I am certainly doing something wrong.

Let me restate the process and what the total code is:

A link on someone else's website page is clicked and my page opens like this:

http://abcwebsite.php?subid=xxxxxx

A link on my page is like this:

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

The following code is the only code in http://abcwebsite/separate.php:

Code:
<?php header ("location:http://xyzwebsite.htm?login=apin&source=".$_GET['subid']); ?>
When the info link on my page is clicked, a page on someone else's website then opens looking like this:

http://xyzwebsite.htm?source=

I am trying to have source= take on the value of subid=

The "second" page is the only page of mine in the process and consists only of html and a form which sends entries and the value of subid in an email to me.

The other two pages in the process belong to others, but when I try using one of my own pages as the third page, source= still has no value.

The only other code on the "second" page is in the form for emails and has no relevance as far as I can see:

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

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

There is no other code.

I need some other code, but I am stumped.

tableman

transfer from url to url

You need to add "subid" to the page link.
Change:
HTML Code:
<a href="http://abcwebsite/separate.php">info</a>
To:
PHP Code:

<a href="http://abcwebsite/separate.php?subid=<?php print $_GET['subid'];?>">info</a>

logic_earth

Previous Question:  [all variants] Evolution Message Filter Problem  Ubuntu Forums  Absolute Beginner TalkNext Question:  [ubuntu] SDL program messed up my display.  Ubuntu Forums  General Help

- Source: transfer from url to url SitePoint Forums PHP
- Previous Question: [all variants] Evolution Message Filter Problem Ubuntu Forums Absolute Beginner Talk
- Next Question: [ubuntu] SDL program messed up my display. Ubuntu Forums General Help