Jump to content

Echo Multiple Variables as One


Leao

Recommended Posts

Hi, I want to send the following variable using the $_GET function:

 



www.example.com/index.php?id=https://twitter.com/intent/tweet?url=http%3A//youtu.be/gvckPiuN9ug&text=The%20first%20kinetic%20typography%20film%20%5B1988%5D%20Oliver%20Harrison%20%5Bpart%5D.:&via=YouTube&related=YouTube,YouTubeTrends,YTCreators


 

The page that receives this variable then echoes it out in a refresh meta tag to redirect to a new page:

 



<meta http-equiv="refresh" content="0; url=
         <?php
echo $_GET[‘id’];
?>" />


 

The problem is that $_GET in the above example contains multiple variables after the initial $id variable, meaning that rather than redirecting to the above URL in its entirety, it instead redirects to:

 



www.twitter.com/intent/tweet?url=http%3A//youtu.be/gvckPiuN9ug


 

Is there a simple way around this?

 

Many thanks,

Leao

Link to comment
https://forums.phpfreaks.com/topic/288902-echo-multiple-variables-as-one/
Share on other sites

you can redirect straight out of php

<?php
header("Location: http://www.example.com?id=1&name=frank"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>

Of course you will need to generate the url string to get this done but that is not too difficult. Beware that you have to use the header function before you made a single output. (ouput like html and e.g. with the echo function from out php)

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.