bhughes Posted January 14, 2013 Share Posted January 14, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/273140-i-wanna-pass-these-variables-to-another-php-file/ Share on other sites More sharing options...
cyberRobot Posted January 14, 2013 Share Posted January 14, 2013 When passing through the URL, those are called GET variables. Have you looked into retrieving the information with $_GET? http://php.net/manual/en/reserved.variables.get.php Quote Link to comment https://forums.phpfreaks.com/topic/273140-i-wanna-pass-these-variables-to-another-php-file/#findComment-1405559 Share on other sites More sharing options...
bhughes Posted January 14, 2013 Author Share Posted January 14, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/273140-i-wanna-pass-these-variables-to-another-php-file/#findComment-1405563 Share on other sites More sharing options...
MDCode Posted January 14, 2013 Share Posted January 14, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/273140-i-wanna-pass-these-variables-to-another-php-file/#findComment-1405578 Share on other sites More sharing options...
bhughes Posted January 14, 2013 Author Share Posted January 14, 2013 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... Quote Link to comment https://forums.phpfreaks.com/topic/273140-i-wanna-pass-these-variables-to-another-php-file/#findComment-1405584 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.