Jump to content

i wanna pass these variables to another php file


bhughes

Recommended Posts

please can someone help me out?

 

$i=0;

while ($i < 10)

 

{

$Variable1 = $1;

$Variable2 = "Hello";

 

/* i wanna pass these variables to another php file

say "http://localhost/receiver.php

 

Once the variables are recieved in the receiver.php, its gonna pass them to an sms gateway

 

header('Location: http://www.address.com/file.php?var1 = ' . $Variable1 . '&var2=' . $Variable2 '); */

 

 

 

$i++;

}

 

 

 

the problem i am facing is that, after the first set of variables is gone, the header function overrides the existing

hence the rest of the loop does not get to execute

 

is there a way out with php alone?

 

thank you.

  On 1/14/2013 at 1:29 PM, cyberRobot said:

When passing through the URL, those are called GET variables. Have you looked into retrieving the information with $_GET?

http://php.net/manua...riables.get.php

 

thanx cyberRobot - but you see am quite new to php - i checked out the link you provided and frankly i dont i have clue on what to do - i was just trying to see if i could figure this out myself - i guess its just too advance for me. if you can point out what i need to do - would appreciate that - if not - i still appreciate your help.

Consider the following URL:

http://domain.com/file.php?var=firstvar&secondvar=2

 

Now say that the following is in file.php

<?php

// Not the most secure by the way.  But will echo "firstvar"
echo $_GET['var'];

// Still not secure by the way.  But will echo 2
echo $_GET['secondvar'];
?>

 

By using $_GET you can access anything in the URL. Just make sure you secure it before using in any queries or outputting on any page

  On 1/14/2013 at 2:53 PM, SocialCloud said:

Consider the following URL:

http://domain.com/file.php?var=firstvar&secondvar=2

 

Now say that the following is in file.php

<?php

// Not the most secure by the way. But will echo "firstvar"
echo $_GET['var'];

// Still not secure by the way. But will echo 2
echo $_GET['secondvar'];
?>

 

By using $_GET you can access anything in the URL. Just make sure you secure it before using in any queries or outputting on any page

 

thanx socialcloud - i think am getting it now - let me get my hands dirty a bit - i'll post my progress soon...

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.