Jump to content

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.

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

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...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.